Example #1
0
        public async Task <bool> Modify(FarmRegion _model)
        {
            _model.UpdatedUser = scopeContext.UserCode;
            _model.UpdatedDate = DateTime.Now;
            context.Update(_model);
            await context.SaveChangesAsync();

            return(true);
        }
Example #2
0
        public async Task <int> Add(FarmRegion _model)
        {
            _model.CreatedUser = scopeContext.UserCode;
            _model.CreatedDate = DateTime.Now;
            context.Add(_model);
            await context.SaveChangesAsync();

            return(_model.Id);
        }
Example #3
0
        public async Task <bool> Modify(int _id, FarmRegionModel _model)
        {
            FarmRegion entity = await svcFarmRegion.GetDetail(_id);

            if (entity == null)
            {
                return(false);
            }
            entity = iMapper.Map(_model, entity);
            return(await svcFarmRegion.Modify(entity));
        }
Example #4
0
        public async Task <bool> Remove(int _id)
        {
            FarmRegion item = await context.FarmRegion.Where(i => i.Id == _id).FirstOrDefaultAsync();

            if (item == default(FarmRegion))
            {
                return(false);
            }
            item.IsDeleted = true;
            context.Entry(item).Property(x => x.IsDeleted).IsModified = true;
            await context.SaveChangesAsync();

            return(true);
        }
Example #5
0
        public async Task <int> Add(FarmRegionModel _model)
        {
            FarmRegion entity = iMapper.Map <FarmRegion>(_model);

            return(await svcFarmRegion.Add(entity));
        }