Exemple #1
0
 internal static ResponseEnvelopeWithDataResult <List <BaseDataModel> > GetDataModels()
 {
     return(new ResponseEnvelopeWithDataResult <List <BaseDataModel> >()
     {
         DataResult = ScaleModelProjectTypeManager.GetEntities().ConvertToDataModels().ConvertAll(x => (BaseDataModel)x)
     });
 }
Exemple #2
0
 internal static ResponseEnvelopeWithDataResult <BaseDataModel> GetLatestDataModel()
 {
     return(new ResponseEnvelopeWithDataResult <BaseDataModel>()
     {
         DataResult = ScaleModelProjectTypeManager.GetEntities().OrderByDescending(x => x.DateCreated).FirstOrDefault().ConvertToDataModel()
     });
 }
Exemple #3
0
 internal static ResponseEnvelopeWithDataResult <BaseDataModel> GetDataModelByGuid(Guid id)
 {
     return(new ResponseEnvelopeWithDataResult <BaseDataModel>()
     {
         DataResult = ScaleModelProjectTypeManager.GetEntityFromGuid(id).ConvertToDataModel()
     });
 }
Exemple #4
0
        internal static ResponseEnvelope CreateEntity(ScaleModelProjectTypeDataModel model)
        {
            ScaleModelProjectType entity = model.ConvertToEntity();

            entity.DateCreated      = DateTime.Now;
            entity.DateLastModified = DateTime.Now;
            return(ScaleModelProjectTypeManager.Create(entity));
        }
Exemple #5
0
        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));
        }
Exemple #6
0
        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());
        }