public IHttpActionResult GenerateImage(int id, [FromBody] string imgUrl) { try { if (id > 0 && imgUrl != null) { Produce.Sender(id, imgUrl); return(Ok("Your image is uploaded successfully :) ")); } else { return(BadRequest("ImageURl or Id is not valid.")); } } catch (Exception) { return(InternalServerError()); } }