public async Task <bool> DeleteStudent(int studentId)
        {
            //Delegate to create an anonymous function for a task
            bool ans = await Task.Run(() => _studentRepository.DeleteStudent(studentId));

            return(ans);
        }
 public void DeleteStudent(int StudentId)
 {
     try
     {
         _StudentRepo.DeleteStudent(StudentId);
     }
     catch (Exception e)
     {
         throw;
     }
 }
        public ActionResult Delete(int id)
        {
            var student = _repo.GetStudentById(id);

            if (student == null)
            {
                return(NotFound());
            }
            _repo.DeleteStudent(id);
            FileUpload.Remove(student.PicturePath, _host.WebRootPath);
            return(Ok(student));
        }
Beispiel #4
0
        public ActionResult DeleteStudent(int id)
        {
            var studentModelFromRepo = _repository.GetStudentById(id);

            if (studentModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteStudent(studentModelFromRepo);
            _repository.SaveChanges();

            return(NoContent());
        }
        public ActionResult DeleteStudent(int id)
        {
            var StudentModelFromDB = _repo.GetStudentById(id);

            if (StudentModelFromDB == null)
            {
                throw new ArgumentNullException(nameof(StudentModelFromDB));
            }
            _repo.DeleteStudent(StudentModelFromDB);
            _repo.SaveChanges();

            return(NoContent());
        }
 public IHttpActionResult DeleteStudent(string id)
 {
     if (!StudentExists(id))
     {
         return(NotFound());
     }
     if (!HasAccesToStudent(id))
     {
         return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.Forbidden)));
     }
     _repo.DeleteStudent(id);
     _repo.SaveChanges();
     return(Ok());
 }
Beispiel #7
0
 public void DeleteStudent(int studentId)
 {
     _studentRepo.DeleteStudent(studentId);
 }
Beispiel #8
0
 public IActionResult DeleteConfirmed(int id)
 {
     studentService.DeleteStudent(id);
     return(RedirectToAction("Index"));
 }
Beispiel #9
0
        public async Task <string> Delete([FromHeader] string PartitionKey)
        {
            string a = await _studentRepo.DeleteStudent(PartitionKey);

            return(a);
        }
Beispiel #10
0
 public IActionResult Delete(int id)
 {
     _repo.DeleteStudent(id);
     return(RedirectToAction("Index"));
 }