コード例 #1
0
        public ActionResult Edit(int id, EditionViewModel model)
        {
            Editions edition = new Editions();

            edition.InjectFrom(model);
            var editionToUpdate = editionService.UpdateEdition(edition);

            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
        public ActionResult Edit(int id, EditionViewModel model)
        {
            Editions edit = new Editions();

            edit.InjectFrom(model);
            var createNewEdition = edition.Update(edit);

            return(RedirectToAction(nameof(Index)));
        }
コード例 #3
0
        public ActionResult Create(EditionViewModel model)
        {
            if (ModelState.IsValid)
            {
                Editions newEdition = new Editions();
                newEdition.InjectFrom(model);

                var createEdition = edition.CreateEdition(newEdition);
                if (createEdition == null)
                {
                    ModelState.AddModelError("CompanyName", "Must be unique");
                    return(View(model));
                }
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #4
0
        public ActionResult Edit(int id, EditionViewModel model)
        {
            if (ModelState.IsValid)
            {
                Editions editionToUpdate = new Editions();

                editionToUpdate.InjectFrom(model);

                var createNewEdition = editions.Update(editionToUpdate);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #5
0
        public ActionResult Create(EditionViewModel model)
        {
            if (ModelState.IsValid)
            {
                Editions edition = new Editions();

                edition.InjectFrom(model);

                var createNewEdition = editionService.AddEdition(edition);

                if (createNewEdition == null)
                {
                    ModelState.AddModelError("Name", "The Name must be unique!");

                    return(View(model));
                }
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #6
0
        public ActionResult Edit(int id, EditionViewModel model)
        {
            if (ModelState.IsValid)
            {
                Editions editionToUpdate = new Editions();

                editionToUpdate.InjectFrom(model);

                var createNewEdition = editions.Update(editionToUpdate);

                if (createNewEdition == null)
                {
                    ModelState.AddModelError("Name", "The Name must be unique!");
                    return(View(model));
                }

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }