private temp_service EditItemFromCart(PatientCartDto temp) { if (dataGridViewCart.CurrentRow.Index != -1) { temp.Id = Convert.ToInt32(dataGridViewCart.CurrentRow.Cells["Id"].Value); } return(dbHelper.temp_service.Find(temp.Id)); }
private void DeleteItemFromCart(PatientCartDto temp) { if (dataGridViewCart.CurrentRow.Index != -1) { temp.Id = Convert.ToInt32(dataGridViewCart.CurrentRow.Cells["Id"].Value); if (MessageBox.Show($"Are you sure you want to delete from the Cart?", "Delete User", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (emedEntities db = new emedEntities()) { var deleteService = db.temp_service.Find(temp.Id); db.temp_service.Remove(deleteService); db.SaveChanges(); MessageBox.Show("Record Deleted Successfully", "Message"); LoadCurrentPatientBills(); } } } }