Esempio n. 1
0
        public ActionResult Create(ExPsico exPsico)
        {
            if (ModelState.IsValid)
            {
                db.ExPsicoes.Add(exPsico);

                var response =
                    DBHelper.SaveChanges(db);

                if (response.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }

                ModelState.
                AddModelError(
                    string.Empty,
                    response.Message);
            }

            return(View(exPsico));
        }
Esempio n. 2
0
        public ActionResult Edit(ExPsico exPsico)
        {
            if (ModelState.IsValid)
            {
                db.Entry(exPsico).State =
                    EntityState.Modified;

                var response =
                    DBHelper.SaveChanges(db);

                if (response.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }

                ModelState.
                AddModelError(
                    string.Empty,
                    response.Message);
            }

            return(View(exPsico));
        }