// DELETE: api/Student/5 public HttpResponseMessage Delete(Guid id) { studentsRepo.DeleteStudent(id); return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <object>(new { Message = "the student deleted successfully" }, Configuration.Formatters.JsonFormatter) }); }
public async Task <string> Delete([FromRoute] string id) { try { await _studentsRepository.DeleteStudent(id); return("S-a sters cu succes!"); } catch (System.Exception e) { return("Eroare: " + e.Message); } }
void Delete() { if (MessageBox.Show ("Delete selected row?", "Not undoable", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes && studentList.Count > 0) { studentsRepository.DeleteStudent(SelectedPerson.ID); studentList.Remove(SelectedPerson); SelectedPerson = studentList[0]; RecordCount = studentList.Count; } }
private async void OnDelete(Data.Student student) { var result = await DialogHelper.ShowDialog(DialogType.Validation, "Are you sure you want to delete this student?"); if (result) { try { if (!student.Attendances.Any()) { _studentsRepository.DeleteStudent(student.StudentGuid); LoadStudents(); } else { throw new ArgumentException("Cannot delete an active student."); } } catch (Exception error) { result = await DialogHelper.ShowDialog(DialogType.Error, error.Message); } } }
public async Task <IActionResult> OnGetDeleteStudentAsync(int id) { await _studentsRepository.DeleteStudent(id); return(RedirectToPage(routeName)); }
public void DeleteStudentById(int id) { _repository.DeleteStudent(id); _repository.Save(); }
public IActionResult Delete([FromRoute] int classId, [FromRoute] int studentId) { _repository.DeleteStudent(classId, studentId); return(NoContent()); }