public AssignmentVM Delete(string dictaatName, int assignmentId)
        {
            if (!AuthorizeResource(dictaatName))
            {
                return(null);
            }

            return(_assignmentRepo.DeleteAssignment(dictaatName, assignmentId));
        }
Example #2
0
        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());
        }
Example #4
0
        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);
        }
Example #5
0
 public void DeleteAssignment(int id)
 {
     _assignmentRepository.DeleteAssignment(id);
 }
Example #6
0
 public async Task DeleteAssignment(Assignment assignment)
 {
     await _assignmentRepository.DeleteAssignment(assignment);
 }