internal static ResponseEnvelopeWithDataResult <List <BaseDataModel> > GetDataModels() { return(new ResponseEnvelopeWithDataResult <List <BaseDataModel> >() { DataResult = ScaleModelProjectTypeManager.GetEntities().ConvertToDataModels().ConvertAll(x => (BaseDataModel)x) }); }
internal static ResponseEnvelopeWithDataResult <BaseDataModel> GetLatestDataModel() { return(new ResponseEnvelopeWithDataResult <BaseDataModel>() { DataResult = ScaleModelProjectTypeManager.GetEntities().OrderByDescending(x => x.DateCreated).FirstOrDefault().ConvertToDataModel() }); }
internal static ResponseEnvelopeWithDataResult <BaseDataModel> GetDataModelByGuid(Guid id) { return(new ResponseEnvelopeWithDataResult <BaseDataModel>() { DataResult = ScaleModelProjectTypeManager.GetEntityFromGuid(id).ConvertToDataModel() }); }
internal static ResponseEnvelope CreateEntity(ScaleModelProjectTypeDataModel model) { ScaleModelProjectType entity = model.ConvertToEntity(); entity.DateCreated = DateTime.Now; entity.DateLastModified = DateTime.Now; return(ScaleModelProjectTypeManager.Create(entity)); }
internal static ResponseEnvelope DeleteEntity(ScaleModelProjectTypeDataModel model) { if (model == null) { return(new ResponseEnvelope(new Exception("Parameter 'model' is empty"))); } ScaleModelProjectType entity = ScaleModelProjectTypeManager.GetEntityFromGuid(model.Id); return(ScaleModelProjectTypeManager.Delete(entity)); }
internal static ResponseEnvelope UpdateEntity(ScaleModelProjectTypeDataModel model) { if (model == null) { return(new ResponseEnvelope(new Exception("Parameter 'model' is empty"))); } ScaleModelProjectType entity = ScaleModelProjectTypeManager.GetEntityFromGuid(model.Id); entity.UpdateFromModel(model); entity.DateLastModified = DateTime.Now; return(ScaleModelProjectTypeManager.Update()); }