public void add() { var childJson = HttpContext.Current.Request.Params["child"]; var child = JsonConvert.DeserializeObject(childJson); CChildParent c = JsonConvert.DeserializeObject <CChildParent>(childJson); // CChildParent child = (CChildParent)ser.DeserializeObject(childJson); if (HttpContext.Current.Request.Files.AllKeys.Any()) { var file = HttpContext.Current.Request.Files["file"]; ; byte[] data; using (Stream inputStream = file.InputStream) { MemoryStream memoryStream = inputStream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); inputStream.CopyTo(memoryStream); } data = memoryStream.ToArray(); c.picture = data; } } BChildrenManager.addChildren(c); }
private void button4_Click(object sender, EventArgs e) { CChildren c = new CChildren(txtIdCH.Text, txtNameCH.Text, txtAddressCH.Text, txtPhoneCH.Text, txtCodeParentCH.Text, int.Parse(txtCodeKinderCH.Text)); BChildrenManager.addChildren(c); txtIdCH.Text = ""; txtNameCH.Text = ""; txtAddressCH.Text = ""; txtPhoneCH.Text = ""; txtCodeParentCH.Text = ""; txtCodeKinderCH.Text = ""; }