예제 #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);
        }
예제 #2
0
        public void Delete(int id)
        {
            var account = _repository.Get(id);

            _repository.Delete(account);
        }
예제 #3
0
 public void Delete(AbstractRepository repo)
 {
     repo.Delete <Account>(this);
 }
예제 #4
0
 /// <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"));
        }
예제 #6
0
        /// <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));
        }
예제 #7
0
 public void Delete(AbstractRepository repo)
 {
     repo.Delete <Book>(this);
 }
예제 #8
0
 /// <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));
 }