Beispiel #1
0
        public async Task <EventDto> EditEventAsync(string id, AddEditEventDto dto)
        {
            var evt = await _unitOfWork.EventRepository.FindAll(x => x.Id.Equals(id)).FirstOrDefaultAsync();

            if (evt == null)
            {
                throw new NotFoundException("Not found event.");
            }

            evt.Title       = dto.Title;
            evt.Description = dto.Description;
            evt.UrlPhotos   = dto.UrlPhotos;

            _unitOfWork.EventRepository.Update(evt);

            await _unitOfWork.CommitAsync();

            return(evt.ToEventDto());
        }
Beispiel #2
0
        public async Task <IActionResult> Update([FromBody] AddEditEventDto dto, string id)
        {
            var result = await _eventService.EditEventAsync(id, dto);

            return(Ok(result));
        }
Beispiel #3
0
 public static Event ToEventEntity(this AddEditEventDto dto, Event entity)
 {
     return(Mapper.Map(dto, entity));
 }
Beispiel #4
0
 public static Event DtoToEntity(this AddEditEventDto dto)
 {
     return(Mapper.Map <Event>(dto));
 }
Beispiel #5
0
 public async Task <HttpResponseMessage> UpdateEventAsync(AddEditEventDto dto, string id)
 {
     return(await _oppJarProxy.PutAsJsonAsync(string.Format(UPDATE_EVENT, id), dto));
 }