public async Task <IHttpActionResult> Get(int id) { var creativeSize = await _creativeSizeService.GetCreativeSize(id).ConfigureAwait(false); if (creativeSize == null) { return(NotFound()); } var retVal = _mapping.Map <CreativeSizeViewModel>(creativeSize); return(Ok(retVal)); }
public async Task <IHttpActionResult> PostDooh(CreativeDoohCreateViewModel model) { if (model == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var brand = await _brandService.GetBrand(model.BrandUuid.GetValueOrDefault(Guid.Empty)).ConfigureAwait(false); if (brand == null) { return(BadRequest("The specified brand was not found.")); } var creativeSize = await _creativeSizeService.GetCreativeSize(model.CreativeSizeId.GetValueOrDefault(0)).ConfigureAwait(false); if (creativeSize == null) { return(BadRequest("The specified creative size was not found.")); } var creativeDoohCreateOptions = _mapping.Map <CreativeDoohCreateOptions>(model); try { var creative = await _creativeService.CreateCreative(creativeDoohCreateOptions).ConfigureAwait(false); creative = await _creativeService.GetCreative(creative.CreativeUuid).ConfigureAwait(false); // reload var creativeViewModel = _mapping.Map <CreativeViewModel>(creative); return(CreatedAtRoute("Creatives.GetById", new { Id = creativeViewModel.CreativeUuid }, creativeViewModel)); } catch (BrandscreenException ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
public static Task <CreativeSize> GetVideoCreativeSize(this ICreativeSizeService creativeSizeService) { return(creativeSizeService.GetCreativeSize(10)); // hardcode id }