public ActionResult Post([FromBody] FileDataContract file, [FromServices] IFileOperations operations) { try { var result = operations.Insert(file); if (result.Error.Any()) { return(BadRequest(result.Error)); } return(Created("", result)); } catch (Exception ex) { return(BadRequest(new { Code = HttpContext.Response.StatusCode, Message = ex.Message })); } }