示例#1
0
        public ActionResult Delete(int?formPK)
        {
            IFormsRepository formsRepository = new FormsRepository(db);

            if (formPK != null)
            {
                Form form = formsRepository.GetFormByPK((int)formPK);

                form.Deleted = true;

                formsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", form.FormPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
示例#2
0
        public ActionResult Edit(FormView formView)
        {
            if (ModelState.IsValid)
            {
                IFormsRepository formsRepository = new FormsRepository(db);

                Form form = formsRepository.GetFormByPK((int)formView.FormPK);
                formView.ConvertTo(formView, form);

                formsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", form.FormPK);

                return(RedirectToAction("Index", "Form"));
            }
            else
            {
                return(View(formView));
            }
        }