public ActionResult DeleteConfirmed(string id) { Llogater llogater = db.Llogaters.Find(id); db.Llogaters.Remove(llogater); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "LlogaterId,NomLlogater,CognomLlogater,CodiPostal,NIF")] Llogater llogater) { if (ModelState.IsValid) { db.Entry(llogater).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(llogater)); }
// GET: Llogaters/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Llogater llogater = db.Llogaters.Find(id); if (llogater == null) { return(HttpNotFound()); } return(View(llogater)); }
public ActionResult Edit([Bind(Include = "NIF,NomCognoms,Telefon,PostCode")] Llogater llogater) { if (ModelState.IsValid) { db.Entry(llogater).State = EntityState.Modified; try { db.SaveChanges(); return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { foreach (var entityValidationError in ex.EntityValidationErrors) { foreach (var validationError in entityValidationError.ValidationErrors) { this.ModelState.AddModelError(validationError.PropertyName, validationError.ErrorMessage); } } return(View(llogater)); } } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "LlogaterId,NomLlogater,CognomLlogater,CodiPostal,NIF")] Llogater llogater) { if (ModelState.IsValid) { db.Llogaters.Add(llogater); try { db.SaveChanges(); return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { foreach (var entityValidationError in ex.EntityValidationErrors) { foreach (var validationError in entityValidationError.ValidationErrors) { this.ModelState.AddModelError(validationError.PropertyName, validationError.ErrorMessage); } } return(View(llogater)); } } return(RedirectToAction("Index")); }