public IActionResult createcatalogue(IFormFile file, string itemName, string itemDesc, int winShapeID, int companyID, decimal itemPrice, int itemID = 0) { try { //! Make Model object var catalogue = new CatalogueModel() { CompanyId = companyID, Itemdesc = itemDesc, ItemId = itemID, Itemname = itemName, Itemprice = itemPrice, WinshapeId = winShapeID, PicFile = file }; if (catalogue.PicFile != null) { using (var binaryStream = new BinaryReader(catalogue.PicFile.OpenReadStream())) { byte[] fileData = binaryStream.ReadBytes((int)catalogue.PicFile.Length); catalogue.Itempic = fileData; } } string strMessage = string.Empty; bool bFlag = _catalogueService.CreateCatalogue(catalogue, out strMessage); return(Ok(new { status = bFlag ? Constants.Success : Constants.Error, message = strMessage })); } catch (Exception ex) { return(Ok(new { status = Constants.Error, message = Constants.ErrorMessage })); } }