public AccountMasterVM CreateAccountMaster(AccountMasterVM accMaster) { accMaster.CreatedDateTime = DateTime.Now; try { context.AccountMasters.Add(Mapper.Map <AccountMasterVM, AccountMaster>(accMaster)); context.SaveChanges(); return(accMaster); } catch (Exception ex) { throw new Exception("Save Account Master failed"); } }
public AccountMasterVM UpdateAccountMaster(AccountMasterVM accMaster) { accMaster.ModifiedDateTime = DateTime.Now; try { context.Entry(Mapper.Map <AccountMasterVM, AccountMaster>(accMaster)).State = EntityState.Modified; context.SaveChanges(); return(accMaster); } catch (Exception ex) { throw new Exception("Update Account Master Failed"); } }
public AccountMasterVM Put(AccountMasterVM accMasterVm) { return(accountMaster.UpdateAccountMaster(accMasterVm)); }
public AccountMasterVM Post(AccountMasterVM accMasterVm) { return(accountMaster.CreateAccountMaster(accMasterVm)); }