Exemplo n.º 1
0
        public ActionResult Add(WayOfRepresentationView wayOfRepresentationView)
        {
            if (ModelState.IsValid)
            {
                IWaysOfRepresentationRepository waysOfRepresentationRepository = new WaysOfRepresentationRepository(db);
                WayOfRepresentation             wayOfRepresentation            = new WayOfRepresentation();

                wayOfRepresentationView.ConvertTo(wayOfRepresentationView, wayOfRepresentation);

                waysOfRepresentationRepository.Add(wayOfRepresentation);
                waysOfRepresentationRepository.SaveChanges();

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

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