Beispiel #1
0
        /// <see cref="IConcertService.SaveSeriesName"/>
        public ServiceResponce SaveSeriesName(SeriesConcertModel model)
        {
            var res      = _concertRepository.SaveSeriesName(ConcertModelHelper.GetSeriesName(model));
            var response = res != null?ServiceResponce
                           .FromSuccess()
                           .Result("Event delete") :
                               ServiceResponce
                               .FromFailed()
                               .Result("Error delete event");

            return(response);
        }
Beispiel #2
0
        /// <see cref="IConcertService.SaveConcert"/>
        public EventModel SaveConcert(EventModel concert, int userId)
        {
            var entity = ConcertModelHelper.GetConcertBase(concert);

            if (concert.Id == 0)
            {
                entity = _concertRepository.AddConcert(entity, userId);
            }
            //if (concert.Hall != null)
            //    entity.Hall = _concertRepository.SaveHall(ConcertModelHelper.GetHall(concert.Hall));
            //if (concert.ConcertPlace != null)
            //    entity.ConcertPlace = _concertRepository.SaveConcertPlace(ConcertModelHelper.GetConcertPlace(concert.ConcertPlace));
            //if (concert.Tickets != null)
            //    entity.Tickets = _concertRepository.SaveConcertTicket(ConcertModelHelper.GetConcertTicket(concert.Tickets));
            var series =
                concert.Series.Select(o => _concertRepository.SaveSeriesName(ConcertModelHelper.GetSeriesName(o)));

            entity.Series = series.Select(o => ConcertModelHelper.GetSeries(entity.Id, o.Id)).ToList();

            entity = _concertRepository.UpdateConcert(entity, userId);
            return(EventModelHelper.GetEventModel(entity));
        }