コード例 #1
0
        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"));
        }
コード例 #2
0
        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"]);
        }