Example #1
0
 public Event Add(Event entity)
 {
     if (EventConflict(entity))
     {
         return(entity);
     }
     return(_postDal.Add(entity));
 }
Example #2
0
 public IResult Add(Event entity)
 {
     try
     {
         _eventDal.Add(entity);
         return(new SuccessResult("İşlem başarılı"));
     }
     catch (Exception e)
     {
         return(new ErrorResult(e.Message));
     }
 }
        public void Add(Event entity)
        {
            entity.Date = entity.Date.AddDays(1);
            var time          = entity.Time.Split(':');
            var hours         = System.Convert.ToInt32(time[0]);
            var minutesString = time[1].Substring(0, 2);
            var minutes       = System.Convert.ToInt32(minutesString);
            var date          = new DateTime(entity.Date.Year, entity.Date.Month, entity.Date.Day, hours, minutes, 0);

            entity.Date = date;
            _eventDal.Add(entity);
        }
Example #4
0
        public async Task ConvertToEventAsync(DatepickerRabbitMq datepickerRabbitMq)
        {
            Guid eventUuid     = Guid.NewGuid();
            var  selectedDates = datepickerRabbitMq.Dates
                                 .FindAll(date => datepickerRabbitMq.SelectedDates
                                          .Exists(dateUuid => dateUuid == date.Uuid));

            var eventDates = _mapper.Map <List <EventDateDto> >(selectedDates);

            eventDates.ForEach(ed =>
            {
                ed.EventUuid = eventUuid;
                ed.EventDateUsers
                .ForEach(edu => edu.EventDateUuid = ed.Uuid);
            });

            var eventDto = _mapper.Map <EventDto>(datepickerRabbitMq);

            eventDto.Uuid       = eventUuid;
            eventDto.EventDates = eventDates;
            eventDto.EventSteps.ForEach(es =>
            {
                es.EventUuid = eventUuid;
                es.Uuid      = Guid.NewGuid();
            });

            await _eventDal.Add(eventDto);

            List <Guid> usersToNotifyUuidCollection = eventDto.EventDates
                                                      .SelectMany(e => e.EventDateUsers
                                                                  .Select(u => u.UserUuid))
                                                      .Distinct()
                                                      .ToList();

            if (usersToNotifyUuidCollection.Count > 0)
            {
                NotifyUsersAboutConversion(usersToNotifyUuidCollection, eventDto);
            }
        }
Example #5
0
 public int Add(Event _event)
 {
     return(_eventDal.Add(_event));
 }