void UpdateBanner(int postId, int bannerImageId) { if (bannerImageId != 0) { _postImageService.Remove(postId, PostImageType.Banner); _postImageService.Add(postId, bannerImageId, PostImageType.Banner); } }
public HttpResponseMessage Create(HttpRequestMessage request, PostImageViewModel postImageVm) { return(CreateHttpResponse(request, () => { if (ModelState.IsValid) { PostImage postImageDb = new PostImage(); postImageDb.UpdatePostImage(postImageVm); _postImageService.Add(postImageDb); _postImageService.SaveChange(); return request.CreateResponse(HttpStatusCode.OK, postImageVm); } else { return request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } })); }