// POST: api/Books public async Task <IHttpActionResult> AddNewCategoryBook() { try { if (ModelState.IsValid) { var httprequest = HttpContext.Current.Request; var model = httprequest.Form["model"]; var bookDetails = JsonConvert.DeserializeObject <BookDetails>(model); var res = await imageRepository.UploadImageToAzure(Request.Content); ////var result = await booksRepository.AddNewBook(bookDetails, res.Message); if (res.StatusCode != HttpStatusCode.OK) { return(BadRequest(res.Message)); } else { var result = await booksRepository.AddNewBook(bookDetails, res.Message); if (result != null) { return(Ok(result)); } else { return(NotFound()); } } } else { return(BadRequest(ModelState)); } } catch (Exception ex) { loggers.LogError(ex); return(InternalServerError()); } }