Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Astronomer astronomer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(astronomer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(astronomer));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Constellation,GalaxyType,ApparentMagnitude,RightAscension,Declination,AstronomerId")] Galaxy galaxy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(galaxy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AstronomerId = new SelectList(db.Astronomers, "Id", "Name", galaxy.AstronomerId);
     return(View(galaxy));
 }
        public ActionResult Edit([Bind(Include = "Id,Name,Constellation,ApparentMagnitude,RightAscension,Declination,AstronomerId,ClusterId")] Star star)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(star).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                ViewBag.AstronomerId = new SelectList(db.Astronomers, "Id", "Name", star.AstronomerId);
                ViewBag.ClusterId    = new SelectList(db.Clusters, "Id", "Name", star.ClusterId);
            }
            catch (RetryLimitExceededException)
            {
                ModelState.AddModelError("", "Unable to save changes.");
            }

            return(View(star));
        }