Esempio n. 1
0
        public ActionResult Delete(int?changeTypePK)
        {
            IChangeTypesRepository changeTypesRepository = new ChangeTypesRepository(db);

            if (changeTypePK != null)
            {
                ChangeType changeType = changeTypesRepository.GetChangeTypeByPK((int)changeTypePK);

                changeType.Deleted = true;

                changeTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", changeType.ChangeTypePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Esempio n. 2
0
        public ActionResult Edit(int?changeTypePK)
        {
            if (changeTypePK != null)
            {
                IChangeTypesRepository changeTypesRepository = new ChangeTypesRepository(db);
                ChangeType             changeType            = changeTypesRepository.GetChangeTypeByPK((int)changeTypePK);
                ChangeTypeView         changeTypeView        = new ChangeTypeView();

                changeTypeView.ConvertFrom(changeType, changeTypeView);

                return(View(changeTypeView));
            }
            else
            {
                return(RedirectToAction("Index", "ChangeType"));
            }
        }
Esempio n. 3
0
        public ActionResult Edit(ChangeTypeView changeTypeModel)
        {
            if (ModelState.IsValid)
            {
                IChangeTypesRepository changeTypesRepository = new ChangeTypesRepository(db);
                ChangeType             changeType            = changeTypesRepository.GetChangeTypeByPK((int)changeTypeModel.ChangeTypePK);
                changeTypeModel.ConvertTo(changeTypeModel, changeType);

                changeTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", changeType.ChangeTypePK);

                return(RedirectToAction("Index", "ChangeType"));
            }
            else
            {
                return(View(changeTypeModel));
            }
        }