public ActionResult Delete(MActionCat viewModel, FormCollection formCollection) { MActionCat mItemCatToDelete = _mActionCatRepository.Get(viewModel.Id); if (mItemCatToDelete != null) { _mActionCatRepository.Delete(mItemCatToDelete); } try { _mActionCatRepository.DbContext.CommitChanges(); } catch (Exception e) { _mActionCatRepository.DbContext.RollbackTransaction(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
private void TransferFormValuesTo(MAction mActionToUpdate, MAction mActionFromForm, FormCollection formCollection) { mActionToUpdate.ActionName = mActionFromForm.ActionName; mActionToUpdate.ActionDesc = mActionFromForm.ActionDesc; mActionToUpdate.ActionPrice = mActionFromForm.ActionPrice; mActionToUpdate.ActionStatus = mActionFromForm.ActionStatus; mActionToUpdate.ActionComponentTool = mActionFromForm.ActionComponentTool; mActionToUpdate.ActionComponentMedician = mActionFromForm.ActionComponentMedician; mActionToUpdate.ActionComponentDoctor = mActionFromForm.ActionComponentDoctor; mActionToUpdate.ActionComponentTherapist = mActionFromForm.ActionComponentTherapist; mActionToUpdate.ActionCatId = _mActionCatRepository.Get(formCollection["ActionCatId"]); }