public async Task <IActionResult> Delete(long id)
        {
            studentRepo = new StudentRepo();
            await studentRepo.Delete(id);

            return(View());
        }
Пример #2
0
        public IActionResult Delete(int id)
        {
            var estu = Repo.Find(id);

            if (estu != null)
            {
                Repo.Delete(estu);
            }
            return(BadRequest());
        }
Пример #3
0
        public async Task <ActionResult> Delete(int id, IFormCollection collection)
        {
            try
            {
                var stu = await studentRepo.GetStudentAsync(id);

                if (stu == null)
                {
                    return(NotFound());
                }
                await studentRepo.Delete(stu);

                return(RedirectToAction(nameof(IndexAsync)));
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                var errorvm = new ErrorViewModel();
                errorvm.RequestId      = Convert.ToString(id);
                errorvm.HttpStatuscode = System.Net.HttpStatusCode.BadRequest;
                return(View("~/Views/Shared/_Error.cshtml", errorvm));
            }
        }
Пример #4
0
 //[HttpPost]
 public IActionResult Delete(int id)
 {
     // Student student = _er.GetStudent(id);
     _er.Delete(id);
     return(RedirectToAction("Index"));
 }
 public void Delete(int id)
 {
     _studentRepo.Delete(id);
 }
 public IActionResult DoDelete(int id)
 {
     repo.Delete(id);
     return(RedirectToAction("Index"));
 }