public async Task <int> UpdatePropCheckListMasterAsync(PropCheckListMaster model)
        {
            _dataSource.Entry(model).State = EntityState.Modified;
            int res = await _dataSource.SaveChangesAsync();

            return(res);
        }
Ejemplo n.º 2
0
        static public PropCheckListMasterModel CreatePropCheckListMasterModelAsync(PropCheckListMaster source, bool includeAllFields)
        {
            var model = new PropCheckListMasterModel()
            {
                PropCheckListMasterId          = source.PropCheckListMasterId,
                PropCheckListMasterGuid        = source.PropCheckListMasterGuid,
                PropCheckListMasterDescription = source.PropCheckListMasterDescription,
            };

            return(model);
        }
Ejemplo n.º 3
0
        public async Task <int> DeletePropCheckListMasterAsync(PropCheckListMasterModel model)
        {
            var propCheckListMaster = new PropCheckListMaster {
                PropCheckListMasterId = model.PropCheckListMasterId
            };

            using (var dataService = DataServiceFactory.CreateDataService())
            {
                return(await dataService.DeletePropCheckListMasterAsync(propCheckListMaster));
            }
        }
Ejemplo n.º 4
0
        public async Task <int> AddPropCheckListMasterAsync(PropCheckListMasterModel model)
        {
            long id = model.PropCheckListMasterId;

            using (var dataService = DataServiceFactory.CreateDataService())
            {
                var propCheckListMaster = new PropCheckListMaster();
                if (propCheckListMaster != null)
                {
                    UpdatePropCheckListMasterFromModel(propCheckListMaster, model);
                    propCheckListMaster.PropCheckListMasterGuid = Guid.NewGuid();
                    propCheckListMaster.PropCheckListMasterId   = await dataService.AddPropCheckListMasterAsync(propCheckListMaster);

                    model.Merge(await GetPropCheckListMasterAsync(dataService, propCheckListMaster.PropCheckListMasterId));
                }
                return(0);
            }
        }
        public async Task <int> AddPropCheckListMasterAsync(PropCheckListMaster model)
        {
            if (model == null)
            {
                return(0);
            }

            var entity = new PropCheckListMaster()
            {
                PropCheckListMasterId          = model.PropCheckListMasterId,
                PropCheckListMasterGuid        = model.PropCheckListMasterGuid,
                PropCheckListMasterDescription = model.PropCheckListMasterDescription,
            };

            _dataSource.Entry(entity).State = EntityState.Added;
            int res = await _dataSource.SaveChangesAsync();

            return(res);
        }
Ejemplo n.º 6
0
 private void UpdatePropCheckListMasterFromModel(PropCheckListMaster target, PropCheckListMasterModel source)
 {
     target.PropCheckListMasterId          = source.PropCheckListMasterId;
     target.PropCheckListMasterGuid        = source.PropCheckListMasterGuid;
     target.PropCheckListMasterDescription = source.PropCheckListMasterDescription;
 }
 public async Task <int> DeletePropCheckListMasterAsync(PropCheckListMaster model)
 {
     _dataSource.PropCheckListMasters.Remove(model);
     return(await _dataSource.SaveChangesAsync());
 }