public async Task <bool> Modify(FarmRegion _model) { _model.UpdatedUser = scopeContext.UserCode; _model.UpdatedDate = DateTime.Now; context.Update(_model); await context.SaveChangesAsync(); return(true); }
public async Task <int> Add(FarmRegion _model) { _model.CreatedUser = scopeContext.UserCode; _model.CreatedDate = DateTime.Now; context.Add(_model); await context.SaveChangesAsync(); return(_model.Id); }
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)); }
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); }
public async Task <int> Add(FarmRegionModel _model) { FarmRegion entity = iMapper.Map <FarmRegion>(_model); return(await svcFarmRegion.Add(entity)); }