Exemple #1
0
        public IActionResult AssignmentDeleteConfirmed(int id)
        {
            Assignment a = _assignmentRepo.GetAssignment(id);

            _assignmentRepo.Delete(a.ID);
            return(RedirectToAction("Home", new { id = a.ClassroomID, loadPartial = "Assignments" }));
        }
Exemple #2
0
        public async Task <IActionResult> Delete([FromRoute] Guid id)
        {
            var result = await _repository.Delete(id);

            if (!result)
            {
                return(NotFound());
            }

            return(Ok());
        }
        public IHttpActionResult DeleteAssignment(int id)
        {
            Assignment assignment = _assignmentRepository.GetById(id);

            if (assignment == null)
            {
                return(NotFound());
            }

            _assignmentRepository.Delete(assignment);
            _unitOfWork.Commit();

            return(Ok(assignment));
        }
Exemple #4
0
        public async Task <IActionResult> DeleteAssignmentModel(int id)
        {
            var result = await _assignmentRepository.Delete(id);

            if (result.Equals("no content"))
            {
                return(NoContent());
            }
            else if (result.Equals("not found"))
            {
                return(NotFound());
            }
            else
            {
                return(BadRequest());
            }
        }
Exemple #5
0
        public async Task <GenericResponseMessage> Delete(Guid id)
        {
            var response = new GenericResponseMessage();

            try
            {
                await _assignmentRepository.Delete(id);

                response.IsSuccessful = true;
                response.Message      = "Successfully deleted assignment.";
            }
            catch (Exception)
            {
                response.IsSuccessful = false;
                response.Message      = $"Could not delete assignment.";
            }

            return(response);
        }
Exemple #6
0
        public async Task <IActionResult> DeleteAssignment(int id)
        {
            if (!_auth.IsValidUser(User))
            {
                return(NoContent());
            }

            var assignmentFromRepo = await _repo.GetAssignment(id);

            if (assignmentFromRepo == null)
            {
                return(BadRequest($"Assignment {id} could not be found."));
            }

            _repo.Delete(assignmentFromRepo);

            if (await _repo.SaveAll())
            {
                return(Ok());
            }

            return(BadRequest("Failed to delete assignment"));
        }
Exemple #7
0
        public async Task <EntityDeletedSuccessfully> DeleteById(string guid)
        {
            _logger.LogInfo($"Deleting assignment with id: {guid} ...");

            var assignment = await _assignmentRepository.FindAssignmentById(Utils.checkGuidFormat(guid));

            if (assignment != null)
            {
                _assignmentRepository.Delete(assignment);

                if (await _assignmentRepository.SaveAll())
                {
                    return(new EntityDeletedSuccessfully(DomainConsts.ENTITY_ASSIGNMENT, $"{DomainConsts.ENTITY_ASSIGNMENT} with id: {guid} is deleted successfully.", HttpStatusCode.OK));
                }
                else
                {
                    _logger.LogError($"Something went wrong while trying to delete assignment with id: {guid}");
                    throw new UnknownException($"Something went wrong while trying to delete assignment with id: {guid}", DomainConsts.APPLICATION_NAME);
                }
            }

            throw new EntityNotFoundException($"{DomainConsts.ENTITY_ASSIGNMENT} with id: {guid} not found.", DomainConsts.APPLICATION_NAME);
        }
 public void DeleteAssignment(AssignmentModel assignmentModel)
 {
     assignmentRepository.Delete(assignmentModel.ID);
 }
 public void DeleteAssignment(string id, string modifiedBy, DateTime lastModification)
 {
     _assignmentRepository.Delete(id, modifiedBy, lastModification);
 }
 public void DeleteAssignment(AssignmentModel assignmentModel)
 {
     _iAssignmentRepository.Delete(_iAssignmentMapper.Map(assignmentModel));
     _iAssignmentRepository.SaveChanges();
 }
Exemple #11
0
 public void DeleteAssignment(int assignmentId)
 {
     assignmentRepository.Delete(assignmentRepository.GetById(assignmentId));
     assignmentRepository.Save();
 }