public ActionResult Insert(MAction viewModel, FormCollection formCollection) { UpdateNumericData(viewModel, formCollection); MAction mActionToInsert = new MAction(); TransferFormValuesTo(mActionToInsert, viewModel, formCollection); mActionToInsert.SetAssignedIdTo(viewModel.Id); mActionToInsert.CreatedDate = DateTime.Now; mActionToInsert.CreatedBy = User.Identity.Name; mActionToInsert.DataStatus = EnumDataStatus.New.ToString(); _mActionRepository.Save(mActionToInsert); try { _mActionRepository.DbContext.CommitChanges(); } catch (Exception e) { _mActionRepository.DbContext.RollbackTransaction(); //throw e.GetBaseException(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }