public AssignmentVM Delete(string dictaatName, int assignmentId) { if (!AuthorizeResource(dictaatName)) { return(null); } return(_assignmentRepo.DeleteAssignment(dictaatName, assignmentId)); }
public IActionResult Delete(int assignmentId) { Assignment deletedAssignment = assignmentRepository.DeleteAssignment(assignmentId); if (deletedAssignment != null) { TempData["message"] = $"{deletedAssignment.Headline} blev slettet."; } return(RedirectToAction(nameof(List))); }
public ActionResult DeleteAssignment(int id) { var assignmentModelFromRepo = _repository.GetAssignmentById(id); if (assignmentModelFromRepo == null) { return(NotFound()); } _repository.DeleteAssignment(assignmentModelFromRepo); _repository.SaveChanges(); return(NoContent()); }
public async Task <int> DeleteAssignment(int id) { var assignmentCallback = await Task.FromResult(_assignmentRepository.GetById(id)); // TODO: Refatorar tipo de retorno. if (assignmentCallback.Result == null) { return(0); } var deleteAssignmentCallback = await Task.FromResult(_assignmentRepository.DeleteAssignment(assignmentCallback.Result)); return(deleteAssignmentCallback.Result); }
public void DeleteAssignment(int id) { _assignmentRepository.DeleteAssignment(id); }
public async Task DeleteAssignment(Assignment assignment) { await _assignmentRepository.DeleteAssignment(assignment); }