public void DeleteStaff_WithValidId_DeleteStaffInDatabaseSuccessfully() { int id = 1; _sut.DeleteStaff(id); _stubDbContext.Verify(c => c.staffs.Remove(_stubStaffList[0])); _stubDbContext.Verify(c => c.SaveChanges()); }
private void btnDeleteStaff_Click(object sender, EventArgs e) { DataGridViewRow r = null; try { r = dgvData.SelectedRows[0]; } catch (Exception exception) { return; } if (MessageBox.Show("Are you sure?", "Prompt", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) != DialogResult.Yes) { return; } int res = _sr.DeleteStaff(Convert.ToInt32(r.Cells[0].Value.ToString())); if (res < 0) { MessageBox.Show("Unable To Delete!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } dgvData.Rows.Remove(r); }
public ActionResult DeletingOfStaff(int StaffID) { var repo = new StaffRepository(); var deleteStaff = repo.DeleteStaff(StaffID); return(View(deleteStaff)); }
public ActionResult Delete(int id = 0) { StaffTable staffTable = new StaffTable(); if (id > 0) { staffRepository.DeleteStaff(id); } return(RedirectToAction("Index")); }
// DELETE: api/Staff/5 /// <summary> /// Delete a staff by its id /// </summary> /// <param name="id"></param> /// <returns>bool</returns> public bool Delete(int id) { return(_staffRepository.DeleteStaff(id)); }