public DbResponse Edit(AccountCrudModel model) { var account = Context.Account.Find(model.AccountId); account.AccountName = model.AccountName; account.CostPercentage = model.CostPercentage; Context.Account.Update(account); Context.SaveChanges(); return(new DbResponse(true, $"{account.AccountName} Updated Successfully")); }
public DbResponse <AccountCrudModel> Add(AccountCrudModel model) { var account = _mapper.Map <Account>(model); Context.Account.Add(account); Context.SaveChanges(); model.AccountId = account.AccountId; return(new DbResponse <AccountCrudModel>(true, $"{model.AccountName} Added Successfully", model)); }