// GET: Rooms public async Task <IActionResult> Index(Guid id) { if (id == Guid.Empty) { id = _userinfo.GetActiveBranches().FirstOrDefault(); } if (id == Guid.Empty) { return(NotFound()); } var welcomeContext = _context.Rooms.OrderBy(r => r.DisplayOrder).Include(r => r.Branch).Include(r => r.RoomType).Where(r => r.BranchID == id); ViewBag.BranchID = id; return(View(await welcomeContext.ToListAsync())); }
public IActionResult Index() { var t = _userinfo.GetActiveBranches(); //User.Claims.Append(new System.Security.Claims.Claim("BranchID", "3db65ecf-b2f4-4329-9f8d-79286eb93b02")); //ClaimsIdentity identity = (ClaimsIdentity)User.Identity; //Console.WriteLine(); //HotelGroup hotelgroup = new HotelGroup { id = Guid.NewGuid(), Name = "Test Hotel Group" }; //db.HotelGroups.Add(hotelgroup); //Hotel hotel = new Hotel { HotelGroup = hotelgroup, Name = "Test Hotel Name", HotelDate = DateTime.Today, ExpirationDate = DateTime.Today.AddYears(1), id = Guid.NewGuid(), IsPayingSupport = true }; //db.Hotels.Add(hotel); //Branch branch = new Branch { Hotel = hotel, id = Guid.NewGuid(), Name = "Test Branch Name" }; //db.Branches.Add(branch); //BranchVardata branchvardata = new BranchVardata { Branch = branch }; //db.BranchVardatas.Add(branchvardata); //db.SaveChanges(); return(View()); }