public IActionResult Register(RegisterRoomViewModel newRoom) { bool result = roomServices.CreateNewRoom(newRoom); if (!result) { return(View(newRoom)); } else { return(Redirect("/Room/All/")); } }
public bool CreateNewRoom(RegisterRoomViewModel newRoom) { //throw new NotImplementedException(); Room room = new Room { Capacity = newRoom.Capacity, RoomType = newRoom.RoomType, FreeRoom = newRoom.FreeRoom, PricePerAdult = newRoom.PricePerAdult, PricePerKid = newRoom.PricePerKid, RoomNumber = newRoom.RoomNumber }; this.context.Rooms.Add(room); this.context.SaveChanges(); room = GetRoom(room.Id); if (room is null) { return(false); } return(true); }