Beispiel #1
0
        /// <summary>
        /// Remove a session from the system.
        /// </summary>
        /// <param name="sessionId">The id of the review session</param>
        /// <param name="current">The API user's username</param>
        /// <exception cref="SessionNotFoundException"></exception>
        /// <exception cref="AuthorizationException"></exception>
        /// <exception cref="InvalidOperationException"></exception>
        public void Delete(int sessionId, string current)
        {
            var session = _sessionRepository.Get(sessionId);

            if (session == null)
            {
                return;
            }

            if (session.SessionStatus >= SessionStatusType.Released)
            {
                throw new InvalidOperationException("Session can't be deleted after it has been released.");
            }

            if (session.Creator.ToLower() != current.ToLower())
            {
                throw new AuthorizationException();
            }

            _sessionRepository.Delete(session);
        }
        public void Delete(int id)
        {
            var account = _repository.Get(id);

            _repository.Delete(account);
        }
 public void Delete(AbstractRepository repo)
 {
     repo.Delete <Account>(this);
 }
 /// <summary>
 /// Function to delete a homework from the repository
 /// </summary>
 /// <param name="id">id of the homework to be deleted</param>
 /// <returns>the deleted homework if it exists, null otherwise</returns>
 public Homework DeleteHomework(string id)
 {
     return(_hwRepo.Delete(id));
 }
        public async Task <IActionResult> DeleteEmployee(int id)
        {
            await _employeeRepository.Delete(id);

            return(new JsonResult("Deleted"));
        }
        /// <summary>
        /// Function to delete a grade from the repository
        /// </summary>
        /// <param name="stId">id of the student</param>
        /// <param name="hwId">id of the homework</param>
        /// <returns>The deleted homework if it exists, null otherwise</returns>
        public Grade DeleteGrade(int stId, string hwId)
        {
            var pair = new KeyValuePair <int, string>(stId, hwId);

            return(_grRepo.Delete(pair));
        }
 public void Delete(AbstractRepository repo)
 {
     repo.Delete <Book>(this);
 }
 /// <summary>
 /// Function to delete a student from the repository
 /// </summary>
 /// <param name="id">id of the student to be deleted</param>
 /// <returns>the deleted student if it exists, null otherwise</returns>
 public Student DeleteStudent(int id)
 {
     return(_studRepo.Delete(id));
 }