public async Task <bool> Modify(FarmingSeason _model) { _model.UpdatedUser = scopeContext.UserCode; _model.UpdatedDate = DateTime.Now; context.Update(_model); await context.SaveChangesAsync(); return(true); }
public async Task <int> Add(FarmingSeason _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, FarmingSeasonModel _model) { FarmingSeason entity = await svcFarmingSeason.GetDetail(_id); if (entity == null) { return(false); } entity = iMapper.Map(_model, entity); return(await svcFarmingSeason.Modify(entity)); }
public async Task <bool> Remove(int _id) { FarmingSeason item = await context.FarmingSeason.Where(i => i.Id == _id).FirstOrDefaultAsync(); if (item == default(FarmingSeason)) { return(false); } item.IsDeleted = true; context.Entry(item).Property(x => x.IsDeleted).IsModified = true; await context.SaveChangesAsync(); return(true); }
public async Task <int> Add(FarmingSeasonModel _model) { FarmingSeason entity = iMapper.Map <FarmingSeason>(_model); return(await svcFarmingSeason.Add(entity)); }