public bool AddOccupannts(OccupantViewModel model) { try { HostelOccupant occupant = new HostelOccupant { FirstName = model.Firstname, Surname = model.Surname, DateOfBirth = model.DateOfBirth, Gender = model.Gender, MaritalStatus = model.MaritalStatus, PhoneNumber = model.PhoneNumber, RoomId = model.RoomID }; _context.HostelOccupant.Add(occupant); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddRoom(RoomViewModel model) { try { Room room = new Room { //Price = model.Price, RoomNumber = model.RoomNumber, IsAvailable = model.IsAvailable, FloorId = model.FloorID, // room.HostelId = (int)model.HostelID; RoomTypeId = model.RoomTypeID }; _context.Room.Add(room); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddFloor(FloorViewModel model) { try { Floor floor = new Floor(); floor.FloorName = model.FloorName; _context.Floor.Add(floor); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddRoomType(RoomTypeViewModel model) { try { RoomType roomtype = new RoomType(); roomtype.Type = model.Type; roomtype.Capacity = model.Capacity; _context.RoomType.Add(roomtype); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddBooking(BookingViewModel model) { try { BookingDetails booking = new BookingDetails { ArrivalDate = model.ArrivalDate, DepartureDate = model.DepartureDate, RoomId = model.RoomID, Price = model.Price }; _context.BookingDetails.Add(booking); _context.SaveChanges(); return(true); } catch (Exception) { return(false); } }