public ActionResult Edit([Bind(Include = "ID,Name,Price")] Service service)
 {
     if (ModelState.IsValid)
     {
         db.Entry(service).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(service));
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "ID,Email,FirstName,LastName,PhoneNumber,created")] Profile profile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     return(View(profile));
 }
 public ActionResult Edit([Bind(Include = "ID,VisitDate,Description,Attention,AnimalID")] HistryVisit histryVisit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(histryVisit).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AnimalID = new SelectList(db.Animals, "ID", "Name", histryVisit.AnimalID);
     return(View(histryVisit));
 }
 public ActionResult Edit([Bind(Include = "ID,CreateTime,Description,Treatment,AnimalID,uslugaID")] HealthCard healthCard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(healthCard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.service = new SelectList(db.Services, "ID", "Name");
     return(View(healthCard));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ID,Title,Synopsis,UserID")] News news)
 {
     if (ModelState.IsValid)
     {
         db.Entry(news).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.Profiles, "ID", "Email", news.UserID);
     return(View(news));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "ID,Name,Colour,Sex,DistinuishingMarks,RaceID,ChipId,Picture,Created,grafting")] Animal animal)
 {
     if (ModelState.IsValid)
     {
         HttpPostedFileBase file = Request.Files["Obrazki"];
         if (file != null && file.ContentLength > 0)
         {
             animal.Picture = file.FileName;
             string path = (HttpContext.Server.MapPath("~/Picture/") + animal.Picture);
             file.SaveAs(path);
         }
         var race = db.Races.Find(animal.RaceID);
         animal.Rasa            = race;
         db.Entry(animal).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Animals"));
     }
     ViewBag.Race = new SelectList(db.Races, "ID", "Name");
     return(View(animal));
 }