public ActionResult DeleteConfirmed(int id)
        {
            Fastighet fastighet = db.Fastighets.Find(id);

            db.Fastighets.Remove(fastighet);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Land,Gatuadress,Postnummer,Postort")] Fastighet fastighet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fastighet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fastighet));
 }
        public ActionResult Create([Bind(Include = "Id,Land,Gatuadress,Postnummer,Postort")] Fastighet fastighet)
        {
            if (ModelState.IsValid)
            {
                db.Fastighets.Add(fastighet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(fastighet));
        }
        // GET: Fastighets/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Fastighet fastighet = db.Fastighets.Find(id);

            if (fastighet == null)
            {
                return(HttpNotFound());
            }
            return(View(fastighet));
        }