public ActionResult CreateRoom(Room room) { var dbRoom = db.room. if (TryValidateModel(room)) { db.Rooms.Add(room); db.SaveChanges(); return Redirect("Index"); } return View(); }
public ActionResult UpdateRoom(Room room) { db.rooms.Attach(room); var entry = db.Entry(room); entry.State = System.Data.Entity.EntityState.Modified; TryUpdateModel<Room>(room); db.SaveChanges(); return View(); }