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()); }
public async Task <IActionResult> Update([FromBody] AddEditEventDto dto, string id) { var result = await _eventService.EditEventAsync(id, dto); return(Ok(result)); }
public static Event ToEventEntity(this AddEditEventDto dto, Event entity) { return(Mapper.Map(dto, entity)); }
public static Event DtoToEntity(this AddEditEventDto dto) { return(Mapper.Map <Event>(dto)); }
public async Task <HttpResponseMessage> UpdateEventAsync(AddEditEventDto dto, string id) { return(await _oppJarProxy.PutAsJsonAsync(string.Format(UPDATE_EVENT, id), dto)); }