// POST api/BinaryItem public async Task <HttpResponseMessage> Post(BinaryUploadRequest binaryUploadRequest) { var binaryItem = new BinaryItem { Id = Guid.NewGuid().ToString("N"), ObjectId = binaryUploadRequest.BinaryId, BinaryType = binaryUploadRequest.BinaryType, UserId = binaryUploadRequest.UserId }; binaryItem.BinaryUrl = await BlobUtils.SaveBinaryToAzureStorage(settings, binaryItem.Id, binaryUploadRequest.BinaryData); if (!string.IsNullOrEmpty(binaryItem.BinaryUrl)) { BeerDrinkinContext context = new BeerDrinkinContext(); context.BinaryItems.Add(binaryItem); await context.SaveChangesAsync(); return(this.Request.CreateResponse(HttpStatusCode.OK)); } return(this.Request.CreateResponse(HttpStatusCode.Conflict, "Something wrong")); }