public async Task <Tour> PostTour(PostTourDto postTourDto) { var startDate = postTourDto.StartDate.Split("T"); var endDate = postTourDto.EndDate.Split("T"); var user = await _userService.GetCurrentUserAsync(); var tour = new Tour { Days = postTourDto.Days, Distance = postTourDto.Distance, StartDate = startDate[0], EndDate = endDate[0], EndPlace = postTourDto.EndPlace, StartPlace = postTourDto.StartPlace, Name = postTourDto.Name, User = user }; var entity = await _dataContext.Tours.AddAsync(tour); await _dataContext.SaveChangesAsync(); return(entity.Entity); }
public async Task <IActionResult> Post(PostTourDto postTourDto) { var response = await tourService.PostTour(postTourDto); return(Ok(response.Id)); }