Ejemplo n.º 1
0
        public bool UpdateShow(ShowModel show)
        {
            var toUpdate = _showRepository.GetShowById(show.Id);

            if (show == null || show.Day == null || show.Seats > Constants.Rows * Constants.Seats)
            {
                return(false);
            }

            if (show.Day > DateTime.Now)
            {
                var v = GetShowByDay(show.Day);
                if (v != null && v.Id != toUpdate.Id)
                {
                    return(false);
                }
            }
            else
            {
                show.Day = toUpdate.Day;
            }

            show.Title        = show.Title ?? toUpdate.Title;
            show.Distribution = show.Distribution ?? toUpdate.Distribution;
            show.Seats        = show.Seats == 0 ? toUpdate.Seats : show.Seats;


            _showRepository.UpdateShow(show.AsDto());

            return(true);
        }
Ejemplo n.º 2
0
        public bool CreateShow(ShowModel show)
        {
            if (show == null || show.Day == null || _showRepository.GetShowByDay(show.Day) != null || show.Title == null || show.Seats == 0 || show.Seats > Constants.Rows * Constants.Seats)
            {
                return(false);
            }

            _showRepository.InsertShow(show.AsDto());

            return(true);
        }