Пример #1
0
 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");
     }
 }
Пример #2
0
        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));
 }