public async Task <IActionResult> Create([Bind("ChannelID,Code,DisplayOrder,HotelID,IsActive,Name,Type")] Agent agent) { if (ModelState.IsValid) { agent.AgentID = Guid.NewGuid(); _context.Add(agent); AgentVardata agentvardata = new AgentVardata { Agent = agent, CreateOn = DateTime.Now }; _context.Add(agentvardata); InvoiceDetail invoicedetail = new InvoiceDetail { Hotel = agent.Hotel, InvoiceStructure_InvoiceName = agent.Name }; _context.Add(invoicedetail); agentvardata.InvoiceDetail = invoicedetail; try { await _context.SaveChangesAsync(); return(RedirectToAction("Edit", new { id = agent.AgentID })); } catch (DbUpdateException ex) { ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } } return(View(agent)); }
Create([Bind("HotelID,Name")] Branch branch) { try { if (ModelState.IsValid) { branch.BranchID = Guid.NewGuid(); _context.Add(branch); BranchVardata branchvardata = new BranchVardata { Branch = branch }; _context.Add(branchvardata); Nationality usualnationality = await _context.Nationalities.FirstOrDefaultAsync(); BranchVardataReservation branchvardatareservation = new BranchVardataReservation { Branch = branch, UsualNationality = usualnationality }; _context.Add(branchvardatareservation); await _context.SaveChangesAsync(); return(RedirectToAction("Edit", new { id = branch.BranchID })); } } catch (DbUpdateException) { ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } ViewData["HotelID"] = new SelectList(_context.Hotels, "HotelID", "Name", branch.HotelID); return(View(branch)); }
public IActionResult Index(WelcomeModel model) { WelcomeModel user = null; using (var db = new WelcomeContext()) //использование контекста { user = db.welcomers.Where(x => x.name == model.name && x.profession == model.profession) .FirstOrDefault(); } if (user == null) { ViewBag.Message = "Добро пожаловать! Вы автоматически зарегистрированы! Пожалуйста, перед тем, как выйти из здания подойдите к соответствующему окну!"; using (var db = new WelcomeContext()) { db.Add(new WelcomeModel { isinbuilding = true, lastin = DateTime.Now, profession = model.profession, name = model.name }); db.SaveChanges(); } return(View()); } ViewBag.Message = "Добро пожаловать!"; return(View()); }
Create([Bind("Abbreviation,Color,DisplayOrder,Grade,HotelID,IncludeInOnlineAvailabilities,IsActive,Name,SuggestedPax")] RoomType roomType) { if (ModelState.IsValid) { roomType.RoomTypeID = Guid.NewGuid(); _context.Add(roomType); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { id = roomType.HotelID })); } return(View(roomType)); }
public async Task <IActionResult> Create([Bind("DisplayOrder,HotelID,IsActive,Name,TaxPrcentage,VatPercentage")] Department department) { if (ModelState.IsValid) { department.DepartmentID = Guid.NewGuid(); _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { id = department.HotelID })); } return(View(department)); }
public async Task <IActionResult> Create([Bind("Code,HotelID,Name")] Pricelist pricelist) { if (ModelState.IsValid) { pricelist.PricelistID = Guid.NewGuid(); _context.Add(pricelist); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { id = pricelist.HotelID })); } return(View(pricelist)); }
public async Task <IActionResult> Create([Bind("id,AA,AskPrePay,AskPrePayDate,AskPrePayRemarks,GuestOrGroup,HotelID,Remarks")] Reservation reservation) { if (ModelState.IsValid) { reservation.ReservationID = Guid.NewGuid(); _context.Add(reservation); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["HotelID"] = new SelectList(_context.Hotels, "HotelID", "Name", reservation.HotelID); return(View(reservation)); }
public async Task <IActionResult> Create([Bind("BranchID,Number,RoomTypeID,DisplayOrder")] Room room) { if (ModelState.IsValid) { room.RoomID = Guid.NewGuid(); _context.Add(room); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { id = room.BranchID })); } Branch branch = await _context.Branches.SingleOrDefaultAsync(m => m.BranchID == room.BranchID); Hotel hotel = await _context.Hotels.SingleOrDefaultAsync(m => m.HotelID == branch.HotelID); var roomtypes = _context.RoomTypes.OrderBy(r => r.DisplayOrder).ThenBy(r => r.Abbreviation).Where(r => r.HotelID == hotel.HotelID); ViewData["RoomTypeID"] = new SelectList(roomtypes, "RoomTypeID", "Abbreviation"); return(View(room)); }
public async Task <IActionResult> Create([Bind("Name")] HotelGroup hotelGroup) { if (ModelState.IsValid) { hotelGroup.HotelGroupID = Guid.NewGuid(); _context.Add(hotelGroup); Hotel hotel = new Hotel { HotelGroup = hotelGroup, HotelID = Guid.NewGuid(), ExpirationDate = DateTime.Today.AddMonths(6), Name = hotelGroup.Name, HotelDate = DateTime.Today }; _context.Add(hotel); //---------------------------------------------------------------- Department Room = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Δωμάτια", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.13M, DisplayOrder = 1 }; Department Breakfast = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Πρωϊνό", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 2 }; Department Lunch = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Γεύμα", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 3 }; Department Dinner = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Δείπνο", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 4 }; Department AllInclusive = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "All Inclusive", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 5 }; _context.AddRange(new[] { Room, Breakfast, Lunch, Dinner, AllInclusive }); Board RR = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "RR", Name = "Room Rate", DisplayOrder = 1 }; Board BB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "BB", Name = "Bed n' breakfast", DisplayOrder = 2 }; Board HL = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "HL", Name = "Half Lunch", DisplayOrder = 3 }; Board HB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "HB", Name = "Half Board", DisplayOrder = 4 }; Board FB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "FB", Name = "Full Board", DisplayOrder = 5 }; Board AI = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "AL", Name = "All Inclusive", DisplayOrder = 6 }; _context.AddRange(new[] { RR, BB, HL, HB, FB, AI }); BoardPart RR_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = RR, Department = Room, ParticipationRate = 1 }; BoardPart BB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = BB, Department = Room, ParticipationRate = 0.95d }; BoardPart BB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = BB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HL_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Room, ParticipationRate = 0.85d }; BoardPart HL_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HL_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Lunch, ParticipationRate = 0.1d }; BoardPart HB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Room, ParticipationRate = 0.85d }; BoardPart HB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HB_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Dinner, ParticipationRate = 0.1d }; BoardPart FB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Room, ParticipationRate = 0.75d }; BoardPart FB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart FB_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Lunch, ParticipationRate = 0.1d }; BoardPart FB_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Dinner, ParticipationRate = 0.1d }; BoardPart AI_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Room, ParticipationRate = 0.7d }; BoardPart AI_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart AI_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Lunch, ParticipationRate = 0.1d }; BoardPart AI_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Dinner, ParticipationRate = 0.1d }; BoardPart AI_AI = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = AllInclusive, ParticipationRate = 0.05d }; _context.AddRange(new[] { RR_Room, BB_Room, BB_Breakfast, HL_Room, HL_Breakfast, HL_Lunch, HB_Room, HB_Breakfast, HB_Dinner, FB_Room, FB_Breakfast, FB_Lunch, FB_Dinner, AI_Room, AI_Breakfast, AI_Lunch, AI_Dinner, AI_AI }); //---------------------------------------------------------------- HotelVardataPlan hotelvardataplan = new HotelVardataPlan { Hotel = hotel }; _context.Add(hotelvardataplan); HotelVardataInvoice hotelvardatainvoice = new HotelVardataInvoice { Hotel = hotel }; _context.Add(hotelvardatainvoice); Branch branch = new Branch { Hotel = hotel, Name = hotel.Name }; _context.Add(branch); BranchVardata branchvardata = new BranchVardata { Branch = branch }; _context.Add(branchvardata); Nationality usualnationality = await _context.Nationalities.FirstOrDefaultAsync(); BranchVardataReservation branchvardatareservation = new BranchVardataReservation { Branch = branch, UsualNationality = usualnationality }; _context.Add(branchvardatareservation); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(hotelGroup)); }
Create([Bind("Dealer,ExpirationDate,HotelDate,HotelGroupID,IsPayingSupport,Name")] Hotel hotel) { try { if (ModelState.IsValid) { hotel.HotelID = Guid.NewGuid(); _context.Add(hotel); Department Room = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Δωμάτια", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.13M, DisplayOrder = 1 }; Department Breakfast = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Πρωϊνό", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 2 }; Department Lunch = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Γεύμα", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 3 }; Department Dinner = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "Δείπνο", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 4 }; Department AllInclusive = new Department { DepartmentID = Guid.NewGuid(), Hotel = hotel, Name = "All Inclusive", IsActive = true, TaxPrcentage = 0.005M, VatPercentage = 0.24M, DisplayOrder = 5 }; _context.AddRange(new[] { Room, Breakfast, Lunch, Dinner, AllInclusive }); Board RR = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "RR", Name = "Room Rate", DisplayOrder = 1 }; Board BB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "BB", Name = "Bed n' breakfast", DisplayOrder = 2 }; Board HL = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "HL", Name = "Half Lunch", DisplayOrder = 3 }; Board HB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "HB", Name = "Half Board", DisplayOrder = 4 }; Board FB = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "FB", Name = "Full Board", DisplayOrder = 5 }; Board AI = new Board { BoardID = Guid.NewGuid(), Hotel = hotel, Abbrevation = "AL", Name = "All Inclusive", DisplayOrder = 6 }; _context.AddRange(new[] { RR, BB, HL, HB, FB, AI }); BoardPart RR_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = RR, Department = Room, ParticipationRate = 1 }; BoardPart BB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = BB, Department = Room, ParticipationRate = 0.95d }; BoardPart BB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = BB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HL_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Room, ParticipationRate = 0.85d }; BoardPart HL_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HL_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HL, Department = Lunch, ParticipationRate = 0.1d }; BoardPart HB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Room, ParticipationRate = 0.85d }; BoardPart HB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart HB_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = HB, Department = Dinner, ParticipationRate = 0.1d }; BoardPart FB_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Room, ParticipationRate = 0.75d }; BoardPart FB_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart FB_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Lunch, ParticipationRate = 0.1d }; BoardPart FB_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = FB, Department = Dinner, ParticipationRate = 0.1d }; BoardPart AI_Room = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Room, ParticipationRate = 0.7d }; BoardPart AI_Breakfast = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Breakfast, ParticipationRate = 0.05d }; BoardPart AI_Lunch = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Lunch, ParticipationRate = 0.1d }; BoardPart AI_Dinner = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = Dinner, ParticipationRate = 0.1d }; BoardPart AI_AI = new BoardPart { BoardPartID = Guid.NewGuid(), Board = AI, Department = AllInclusive, ParticipationRate = 0.05d }; _context.AddRange(new[] { RR_Room, BB_Room, BB_Breakfast, HL_Room, HL_Breakfast, HL_Lunch, HB_Room, HB_Breakfast, HB_Dinner, FB_Room, FB_Breakfast, FB_Lunch, FB_Dinner, AI_Room, AI_Breakfast, AI_Lunch, AI_Dinner, AI_AI }); HotelVardataPlan hotelvardataplan = new HotelVardataPlan { Hotel = hotel }; _context.Add(hotelvardataplan); HotelVardataInvoice hotelvardatainvoice = new HotelVardataInvoice { Hotel = hotel }; _context.Add(hotelvardatainvoice); Branch branch = new Branch { Hotel = hotel, Name = hotel.Name }; _context.Add(branch); BranchVardata branchvardata = new BranchVardata { Branch = branch }; _context.Add(branchvardata); Nationality usualnationality = await _context.Nationalities.FirstOrDefaultAsync(); BranchVardataReservation branchvardatareservation = new BranchVardataReservation { Branch = branch, UsualNationality = usualnationality }; _context.Add(branchvardatareservation); await _context.SaveChangesAsync(); return(RedirectToAction("Edit", new { id = hotel.HotelID })); } } catch (DbUpdateException ex) { ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } ViewData["HotelGroupID"] = new SelectList(_context.HotelGroups, "HotelGroupID", "Name", hotel.HotelGroupID); return(View(hotel)); }