Esempio n. 1
0
 public ActionResult AddEditAccountType(long?id, AccountTypeViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             bool        isNew       = !id.HasValue;
             AccountType accountType = isNew ? new AccountType
             {
                 //AddedDate = DateTime.UtcNow
             } : accountTypeRepository.GetAccountType(id.Value);
             accountType.accTypeName = model.accTypeName;
             if (isNew)
             {
                 accountTypeRepository.SaveAccountType(accountType);
             }
             else
             {
                 accountTypeRepository.UpdateAccountType(accountType);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(RedirectToAction("Index"));
 }