Ejemplo n.º 1
0
        public ActionResult Create(Afpe afpe)
        {
            if (ModelState.IsValid)
            {
                db.Afpes.Add(afpe);

                var response =
                    DBHelper.SaveChanges(db);

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

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

            return(View(afpe));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(Afpe afpe)
        {
            if (ModelState.IsValid)
            {
                db.Entry(afpe).
                State = EntityState.Modified;

                var response =
                    DBHelper.SaveChanges(db);

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

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

            return(View(afpe));
        }