private void SaveUpdateValidate(Area area, ILayoutService ls, ISeatService ss) { var lsAll = ls.GetAll(); var ssAll = ss.GetAll(); var all = GetAll(); if (!(from x in lsAll where x.Id == area.LayoutId select x).Any()) { throw new Exception("No such layout"); } var areaLowerSet = from x in all where x.LayoutId == area.LayoutId && (x.CoordX < area.CoordX || x.CoordY < area.CoordY) select x; if (areaLowerSet.Any()) { foreach (var v in areaLowerSet.ToList()) { var seatSet = from x in ssAll where x.AreaId == v.Id select x; if (seatSet.Any()) { if (v.CoordX + seatSet.Max(x => x.Row) > area.CoordX || v.CoordY + seatSet.Max(x => x.Number) > area.CoordY) { throw new Exception("Area coords out of range"); } } } } }
public void RefreshSeats() { ObservableCollection <SeatDTO> seats = new ObservableCollection <SeatDTO>(); foreach (SeatDTO seat in seatService.GetAll().Data.ToList <SeatDTO>()) { if (seat.VanId == SelectedVanId) { seats.Add(seat); } } Seats = seats; OnPropertyChanged(nameof(Seats)); }
public ActionResult <ICollection <Seat> > GetAll() { return(new OkObjectResult(service.GetAll())); }