コード例 #1
0
        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"));
 }
コード例 #5
0
 public void Delete(int id)
 {
     _studentRepo.Delete(id);
 }
コード例 #6
0
 public IActionResult DoDelete(int id)
 {
     repo.Delete(id);
     return(RedirectToAction("Index"));
 }