コード例 #1
0
ファイル: Students.cs プロジェクト: waild/SGMCoreCourse
        public async Task <ActionResult> Delete(int id, IFormCollection collection)
        {
            try
            {
                await coursesRepository.DeleteAsync(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public async Task<IActionResult> Delete(Guid studentID)
        {
            try
            {
                var res = await _studentRepository.DeleteAsync(studentID);

                return Ok(res);
            }
            catch (Exception ex)
            {
                return BadRequest(ex);
            }
        }