public async Task <ActionResult <SingleResponse <Document> > > AddPdf([FromForm] PdfDocument pdf) { if (pdf == null) { return(BadRequest("Please provide PDF")); } var response = new SingleResponse <Document>(); if (!ModelState.IsValid) { response.ErrorMessage = _modelStateErrorHandler.GetValues(ModelState); return(new ObjectResult(response) { StatusCode = (int)HttpStatusCode.BadRequest }); } var location = await _service.AddDocument(pdf.File); response.Model = await _service.AddDocumentRecord(pdf.File.FileName, location, pdf.File.Length); return(new ObjectResult(response) { StatusCode = (int)HttpStatusCode.Created }); }