示例#1
0
        public ViewResult UpdateHall(int id)
        {
            var hall = _hallManager.GetHall(id);
            var hallOpeningHoursVM = new HallOpeningHoursVM {
                Hall = new Hall {
                    HallId    = hall.HallId,
                    Name      = hall.Name,
                    Size      = hall.Size,
                    Price     = hall.Price,
                    Available = hall.Available
                },
                OpeningHours = new List <OpeningHours>(),
                SportManager = _sportManager,
                SportObjects = _sportManager.GetSportObjectsFromHall(hall)
            };

            foreach (var oh in hall.HallOpeningHours)
            {
                hallOpeningHoursVM.OpeningHours.Add(new OpeningHours()
                {
                    OpeningHoursId = oh.OpeningHours.OpeningHoursId,
                    Day            = oh.OpeningHours.Day,
                    OpeningTime    = oh.OpeningHours.OpeningTime,
                    ClosingTime    = oh.OpeningHours.ClosingTime
                });
            }
            return(View("UpdateHall", hallOpeningHoursVM));
        }
示例#2
0
        public HallErrorCodes RemoveHall(int hallID)
        {
            var hall = hallManager.GetHall(hallID);

            if (hall == null)
            {
                return(HallErrorCodes.NoSuchHall);
            }
            else
            {
                if (hall.Shelves.Count > 0)
                {
                    return(HallErrorCodes.ThereAreShelvesInThisHall);
                }
                else
                {
                    hallManager.RemoveHall(hall);
                    return(HallErrorCodes.ok);
                }
            }
        }
        public IActionResult GetHall(int id)
        {
            var hall = _hallManager.GetHall(id);

            if (hall == null)
            {
                return(NotFound());
            }

            var hallMapped = _mapper.Map <HallDTO>(hall);

            return(this.HAL(hallMapped, hallMapped.GetLinks()));
        }