Пример #1
0
        // GET: CatAgeGroup/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CatAgeGroup catalogo = db.CatAgeGroup.Find(id);

            if (catalogo == null)
            {
                return(HttpNotFound());
            }
            return(View(catalogo));
        }
Пример #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         CatAgeGroup student = db.CatAgeGroup.Find(id);
         db.CatAgeGroup.Remove(student);
         db.SaveChanges();
     }
     catch (RetryLimitExceededException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         return(RedirectToAction("Delete", new { id = id, saveChangesError = true }));
     }
     return(RedirectToAction("Index"));
 }
Пример #3
0
        // GET: CatAgeGroup/Delete/5
        public ActionResult Delete(int?id, bool?saveChangesError = false)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (saveChangesError.GetValueOrDefault())
            {
                ViewBag.ErrorMessage = "Delete failed. Try again, and if the problem persists see your system administrator.";
            }
            CatAgeGroup catalogo = db.CatAgeGroup.Find(id);

            if (catalogo == null)
            {
                return(HttpNotFound());
            }
            return(View(catalogo));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "id_conf_country, AgeGroup, month_begin, month_end, label_fluid")] CatAgeGroup catalog)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user      = UserManager.FindById(User.Identity.GetUserId());
                    var countryId = user.Institution.CountryID ?? 0;

                    catalog.id_country = countryId;
                    db.CatAgeGroup.Add(catalog);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                ModelState.AddModelError("", "No es posible guardar los datos. Intente de nuevo, si el problema persiste contacte al administrador.");
            }
            return(View(catalog));
        }