public ActionResult CreateRoom(Room crumbsmodel) { if (ModelState.IsValid) { try { crumbsmodel.Name = crumbsmodel.Name.Replace(' ', '-'); Room room = roomRepository.AllRooms.FirstOrDefault(item => item.Name == crumbsmodel.Name); if (room == null) { roomRepository.InsertOrUpdateRoom(crumbsmodel); roomRepository.Save(); return RedirectToAction("MultiPlayerRoom", new { name = crumbsmodel.Name }); } } catch (Exception ex) { Console.WriteLine("Exception is:" + ex.ToString()); } } return View(crumbsmodel); }
// // GET: /Room/CreateRoom public ActionResult CreateRoom() { Room crumbsmodel = new Room(); return View(crumbsmodel); }