Пример #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            Llogater llogater = db.Llogaters.Find(id);

            db.Llogaters.Remove(llogater);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 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));
 }
Пример #3
0
        // 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));
        }
Пример #4
0
 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"));
 }
Пример #5
0
 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"));
 }