Add Photosynthesis Type
This commit is contained in:
@@ -60,5 +60,15 @@ namespace LeafWeb.Core.DAL
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public IQueryable<PhotosynthesisType> GetPhotosynthesisTypes()
|
||||
{
|
||||
return _db.PhotosynthesisTypes.OrderBy(pt => pt.SortOrder);
|
||||
}
|
||||
|
||||
public PhotosynthesisType GetPhotosynthesisType(string id)
|
||||
{
|
||||
return _db.PhotosynthesisTypes.Find(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace LeafWeb.Core.DAL
|
||||
|
||||
var photosynthesisTypes = new []
|
||||
{
|
||||
new PhotosynthesisType {Id = "C3_photosynthesis_leafweb", Name = "C3 Photosynthesis"},
|
||||
new PhotosynthesisType {Id = "C4_photosynthesis_leafweb", Name = "C4 Photosynthesis"},
|
||||
new PhotosynthesisType {Id = "CAM_photosynthesis_leafweb", Name = "CAM Photosynthesis"}
|
||||
new PhotosynthesisType {Id = "C3_photosynthesis_leafweb", Name = "C3 Photosynthesis", SortOrder = 1},
|
||||
new PhotosynthesisType {Id = "C4_photosynthesis_leafweb", Name = "C4 Photosynthesis", SortOrder = 2},
|
||||
new PhotosynthesisType {Id = "CAM_photosynthesis_leafweb", Name = "CAM Photosynthesis", SortOrder = 3}
|
||||
};
|
||||
|
||||
context.PhotosynthesisTypes.AddRange(photosynthesisTypes);
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace LeafWeb.Core.Models
|
||||
[Required(ErrorMessage = "")]
|
||||
public string SiteId { get; set; }
|
||||
|
||||
public virtual PhotosynthesisType Photosynthesis { get; set; }
|
||||
[Required(ErrorMessage = "PhotosynthesisType required")]
|
||||
public virtual PhotosynthesisType PhotosynthesisType { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
[Required]
|
||||
|
||||
@@ -10,5 +10,7 @@ namespace LeafWeb.Core.Models
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user