コード例 #1
0
        public ActionResult Delete(int?wayOfRepresentationPK)
        {
            IWaysOfRepresentationRepository waysOfRepresentationRepository = new WaysOfRepresentationRepository(db);

            if (wayOfRepresentationPK != null)
            {
                WayOfRepresentation wayOfRepresentation = waysOfRepresentationRepository.GetWayOfRepresentationByPK((int)wayOfRepresentationPK);

                wayOfRepresentation.Deleted = true;

                waysOfRepresentationRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", wayOfRepresentation.WayOfRepresentationPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
コード例 #2
0
        public ActionResult Edit(int?wayOfRepresentationPK)
        {
            if (wayOfRepresentationPK != null)
            {
                IWaysOfRepresentationRepository waysOfRepresentationRepository = new WaysOfRepresentationRepository(db);
                WayOfRepresentation             wayOfRepresentation            = waysOfRepresentationRepository.GetWayOfRepresentationByPK((int)wayOfRepresentationPK);
                WayOfRepresentationView         wayOfRepresentationView        = new WayOfRepresentationView();

                wayOfRepresentationView.ConvertFrom(wayOfRepresentation, wayOfRepresentationView);

                return(View(wayOfRepresentationView));
            }
            else
            {
                return(RedirectToAction("Index", "WayOfRepresentation"));
            }
        }
コード例 #3
0
        public ActionResult Edit(WayOfRepresentationView wayOfRepresentationModel)
        {
            if (ModelState.IsValid)
            {
                IWaysOfRepresentationRepository waysOfRepresentationRepository = new WaysOfRepresentationRepository(db);
                WayOfRepresentation             wayOfRepresentation            = waysOfRepresentationRepository.GetWayOfRepresentationByPK((int)wayOfRepresentationModel.WayOfRepresentationPK);
                wayOfRepresentationModel.ConvertTo(wayOfRepresentationModel, wayOfRepresentation);

                waysOfRepresentationRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", wayOfRepresentation.WayOfRepresentationPK);

                return(RedirectToAction("Index", "WayOfRepresentation"));
            }
            else
            {
                return(View(wayOfRepresentationModel));
            }
        }