public ActionResult Edit([Bind(Include = "Id,Fordontyp,Färg,Regnr,Märke,Modell,Ägare,Parkerad")] FordonModel fordonModel)
 {
     if (ModelState.IsValid)
     {
         db.Edit(fordonModel);
         return(RedirectToAction("Index"));
     }
     return(View(fordonModel));
 }
        // GET: FordonModels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FordonModel fordonModel = db.Find(id);

            if (fordonModel == null)
            {
                return(HttpNotFound());
            }
            return(View(fordonModel));
        }
Exemple #3
0
 public void Edit(FordonModel fordon)
 {
     this.Entry(fordon).State = EntityState.Modified;
     this.SaveChanges();
 }
Exemple #4
0
 public FordonModel Find(FordonModel fordon)
 {
     return(Fordon.Find(fordon.Id));
 }
Exemple #5
0
 public void Remove(FordonModel fordon)
 {
     this.Remove(fordon);
 }
Exemple #6
0
 public void Add(FordonModel fordon)
 {
     Fordon.Add(fordon);
     this.SaveChanges();
 }