public async Task <MenuUnit> Add(MenuUnit model) { var entity = _menuUnitRepository.Add(model); await _menuUnitRepository.SaveChangeAsync(); return(model); }
public async Task <bool> Put(MenuUnit model) { var result = false; if (ModelState.IsValid) { result = await _menuUnitBusiness.Update(model); } return(result); }
public async Task <int> Post(MenuUnit model) { var result = 0; if (ModelState.IsValid) { model.Status = 1; var modelInsert = await _menuUnitBusiness.Add(model); result = modelInsert.Id; } return(result); }
public async Task <bool> Update(MenuUnit model) { var result = false; var record = await _menuUnitRepository.Repo.FirstOrDefaultAsync(c => c.Id == model.Id); if (record != null) { record.Name = model.Name; await _menuUnitRepository.SaveChangeAsync(); result = true; } return(result); }