public DeleteStudent DeleteStudent(DeleteStudent obj) { var returnModel = new DeleteStudent(); var Student = _studentsRepo.Get(obj.StudentId); var studentsList = _studentsRepo.GetAll().ToList(); var StudentPromotionsList = _StudentPromotionsRepo.GetAll().ToList(); var query = (from p in StudentPromotionsList where p.StudentId == obj.StudentId select p); foreach (var item in query) { var StudentPromotion = _StudentPromotionsRepo.Get(item.Id); if (StudentPromotion != null) { _StudentPromotionsRepo.Delete(StudentPromotion); returnModel.Message = "Delete Successful."; } } if (Student != null) { _studentsRepo.Delete(Student); if (Student.IP300X200 != null) { string DelImgofIP300X200 = Path.Combine(obj.WebRootPath, Student.IP300X200); _commonServ.DelFileFromLocation(DelImgofIP300X200); } returnModel.Message = "Delete Successful."; } return(returnModel); }
public DeleteStudentPromotion DeleteStudentPromotion(DeleteStudentPromotion obj) { var returnModel = new DeleteStudentPromotion(); var StudentPromotions = _StudentPromotionsRepo.Get(obj.StudentPromotionsId); if (StudentPromotions != null) { _StudentPromotionsRepo.Delete(StudentPromotions); } return(returnModel); }