public async Task <IActionResult> CreateExcursion(ExcursionDto excursionDto) { var excursion = _mapper.Map <Excursion>(excursionDto); _repo.Add(excursion); await _repo.SaveAll(); return(Ok()); }
static void CreateTours(ITourService tourService) { var client1 = new ClientDto() { Id = Guid.NewGuid(), Name = "Alexandr" }; var client2 = new ClientDto() { Id = Guid.NewGuid(), Name = "Roman" }; var ex1 = new ExcursionDto() { Id = Guid.NewGuid(), Name = "Kiyv" }; var ex2 = new ExcursionDto() { Id = Guid.NewGuid(), Name = "Kharkiv" }; var tour1 = new TourDto() { Id = Guid.NewGuid(), Date = new DateTime(2018, 08, 01), Client = client1, Excursion = ex1 }; var tour2 = new TourDto() { Id = Guid.NewGuid(), Date = new DateTime(2018, 08, 01), Client = client2, Excursion = ex1 }; var tour3 = new TourDto() { Id = Guid.NewGuid(), Date = new DateTime(2018, 08, 01), Client = client1, Excursion = ex2 }; tourService.Create(tour1); tourService.Create(tour2); tourService.Create(tour3); }
public Guid Post([FromBody] ExcursionDto excursion) { return(_services.Excursions.SetExcursion(excursion.Name, excursion.ExcursionSights)); }