Files
Web_AuthorityManagement_Mvc…/UI/Controllers/HotelController.cs
2025-11-20 09:51:24 +08:00

58 lines
1.8 KiB
C#

using Services.Cache;
using Services.Manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Models.ModelItems;
using Services.Extensions;
namespace UI.Controllers
{
public class HotelController : BaseController
{
public HotelController()
{
base.ViewBag.Select = 3;
}
// GET: Hotel
public ActionResult Index(int id)
{
try
{
HotelGroups hotelGroups = CacheHelp.cacheHoteldGroups.FirstOrDefault(x=>x.Id == id);
if(hotelGroups == null)
throw new CustomException("无酒店组信息!");
ViewBag.SelHoteldGroup = id;
var data = CacheHelp.cacheHoteldGroups.Where(x => x.ParentId == id).ToList();
data.Insert(0,hotelGroups);
ViewBag.DataGroups = JsonConvert.SerializeObject(data);
ViewBag.Data = JsonConvert.SerializeObject(
CacheHelp.cacheHotels.Where(x=> data.FirstOrDefault(y=>y.Id == x.GroupId)!=null ).GroupBy(x=>x.GroupId).ToList());
ViewBag.HoteldGroupName = hotelGroups.Name;
return View();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
HttpContext.Response.StatusCode = 500;
return null;
}
}
public ActionResult Hotellist()
{
return View();
}
[HttpPost]
/// <summary>
/// 查看酒店 下方人员信息
/// </summary>
/// <returns></returns>
public ActionResult HotelInfo()
{
return Json(HotelServer.FindUserinfo());
}
}
}