This commit is contained in:
2025-09-25 15:18:34 +08:00
parent c6bd763485
commit 71490b1fac
14 changed files with 759 additions and 63 deletions

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data.Entity;
using System.Drawing;
using System.Linq;
using System.Net;
using System.ServiceModel.Channels;
using System.Threading.Tasks;
using System.Web;
@@ -99,6 +100,23 @@ public class regionRoomController : ApiController
{
return BadRequest("請輸入床位數量");
}
if (room.IsActive == false)
{
var hasPendingBeds = oldRoom.RegionRoomBed
.SelectMany(b => b.GuaDanOrderGuest)
.Any(g => !g.IsDeleted &&
(g.RegionRoomBedStatus.Code == GuaDanOrderGuest.STATUS_BOOKED || // 预约中
g.RegionRoomBedStatus.Code == GuaDanOrderGuest.STATUS_CHECKED_IN)); // 已入住
if (hasPendingBeds)
{
return Content(HttpStatusCode.BadRequest, new
{
code = "BED_IS_USED",
message = "該房间有床位正在掛單中,請先處理"
});
}
}
oldRoom.Name = room.Name;
oldRoom.BedCount = room.BedCount;
oldRoom.Gender = room.Gender;