public HttpResponseMessage Post([FromBody] Owner value) { try { byte[] data = null; if (value.Image != null) { MemoryStream target = new MemoryStream(); value.Image.InputStream.CopyTo(target); data = target.ToArray(); } dc.Owner_Insert(value.Username, value.Password, value.FirstName, value.LastName, data, value.NationalCode, value.Address, value.PostalCode, value.PhoneNumber); return(Request.CreateResponse(HttpStatusCode.OK, value)); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message)); } }