guadan
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user