public IActionResult OnGet(int?id)
 {
     CreateObj = new Faculty();
     if (id != null)
     {
         CreateObj = _facultyRepo.GetFisrtOrDefault(c => c.Id == id.GetValueOrDefault());
         if (CreateObj == null)
         {
             return(NotFound());
         }
     }
     return(Page());
 }
Beispiel #2
0
        public IActionResult DeleteFaculty(int id)
        {
            var facultyFromDb = _facultyRepo.GetFisrtOrDefault(c => c.Id == id);

            if (facultyFromDb != null)
            {
                _facultyRepo.Remove(facultyFromDb);
                _facultyRepo.Save();
                return(Json(new { status = true, message = "Deleted Suucessfully" }));
            }
            else
            {
                return(Json(new { status = false, message = "Unable to delete" }));
            }
        }