public Task <int> UpdateModel(int id, Models.AccountingCategory model) { var existingModel = _dbContext.AccountingCategories.FirstOrDefault(entity => entity.Id == id); existingModel.Code = model.Code; existingModel.Name = model.Name; MoonlayEntityExtension.FlagForUpdate(existingModel, _identityService.Username, UserAgent); _dbContext.AccountingCategories.Update(existingModel); return(_dbContext.SaveChangesAsync()); }
public Task <int> CreateModel(Models.AccountingCategory model) { MoonlayEntityExtension.FlagForCreate(model, _identityService.Username, UserAgent); _dbContext.AccountingCategories.Add(model); return(_dbContext.SaveChangesAsync()); }