public async Task <IHttpActionResult> CreateSite( int customerId, CreateSiteRequestDto model ) { var result = await sitesHelper.CreateSite(customerId, model); if (!result.Status.HasFlag(SiteStatus.Success)) { return(Content( HttpStatusCode.BadRequest, new ErrorResponseDto() { Error = ErrorCode.InvalidRequest, Message = ErrorCode.InvalidRequest.Description(), Details = result.Status.GetConcatString() } )); } return(Created( new Uri(Request.RequestUri, result.Content.ToString()), new PostResponseDto <Guid>() { Id = result.Content } )); }
/// <summary> /// Creates the site. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="model">The model.</param> /// <returns></returns> public async Task <OperationResultDto <Guid, SiteStatus> > CreateSite( int customerId, CreateSiteRequestDto model ) { var site = Mapper.Map <CreateSiteRequestDto, Site>(model); site.CustomerId = customerId; var result = await sitesService.CreateSite(site); return(result); }