public void Student_DeleteTest() { StudentViewModel vm = new StudentViewModel { LastName = "Desjardins" }; vm.GetByLastName(); int studentsDeleted = vm.Delete(); Assert.True(studentsDeleted == 1); }
public IHttpActionResult Delete(int id) { try { StudentViewModel stu = new StudentViewModel(); stu.Id = id; if (stu.Delete() == 1) { return(Ok("Student deleted!")); } else { return(Ok("Student not deleted!")); } } catch (Exception ex) { return(BadRequest("Delete failed - Contact Tech Support")); } }
public IActionResult Delete(StudentViewModel vm) { vm.Delete(); return(View(vm)); }