public IHttpActionResult PutcustomerInfo(int id, customerInfo customerInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customerInfo.customerID) { return(BadRequest()); } db.Entry(customerInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!customerInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetcustomerInfo(int id) { customerInfo customerInfo = db.customerInfoes.Find(id); if (customerInfo == null) { return(NotFound()); } return(Ok(customerInfo)); }
public IHttpActionResult PostcustomerInfo(customerInfo customerInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.customerInfoes.Add(customerInfo); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = customerInfo.customerID }, customerInfo)); }
private void Dgvcustom_RowDividerDoubleClick(object sender, DataGridViewRowDividerDoubleClickEventArgs e) { Btndel.Visible = true; Btnupd.Visible = true; int customid = Convert.ToInt32(Dgvcustom.Rows[e.RowIndex].Cells[0].Value); custom = _context.customerInfos.Find(customid); Txtna.Text = custom.Name; Txtsu.Text = custom.Surname; Txtemail.Text = custom.Email; Txtph.Text = custom.Phone; }
private void Btnadd_Click(object sender, EventArgs e) { customerInfo cm = new customerInfo { Name = Txtname.Text, Surname = Txtsurname.Text, Email = Txtemail.Text, Phone = Txtphone.Text }; this._context.customerInfos.Add(cm); this._context.SaveChanges(); MessageBox.Show("Customer Add"); }
public IHttpActionResult DeletecustomerInfo(int id) { customerInfo customerInfo = db.customerInfoes.Find(id); if (customerInfo == null) { return(NotFound()); } db.customerInfoes.Remove(customerInfo); db.SaveChanges(); return(Ok(customerInfo)); }
public async Task AddTimeline(customerInfo timeline) { await this.timelineTable.InsertAsync(timeline); }