public void Initialize() { this.validator = new CreateClinicRequestValidator(); this.dto = new CreateClinicRequest { Country = Location.MinCountry, City = Location.Cities[0], Street = Location.Streets[0] }; }
public CreateClinicResponse Post(CreateClinicRequest request) { var clinic = this.clinicsApplication.Create(Request.ToCaller(), request.Country, request.City, request.Street); Response.SetLocation(clinic); return(new CreateClinicResponse { Clinic = clinic }); }
public async Task <IActionResult> Post([FromBody] CreateClinicRequest request) { var clinicCommand = mapper.Map <CreateClinicCommand>(request); clinicCommand.CreatedBy = Guid.Parse(User.Claims.FirstOrDefault(x => x.Type == "id").Value); var clinicCreateResponse = await clinicApi.SaveClinic(clinicCommand); var clinicCreateContent = await clinicCreateResponse.Content.DeserializeStringContent <string>(); if (!clinicCreateResponse.IsSuccessStatusCode) { return(BadRequest(clinicCreateContent)); } return(CreatedAtAction(nameof(GetClinicById), new { id = clinicCreateContent }, clinicCreateContent)); }