sachin Shrestha
Member
- Joined
- Oct 31, 2021
- Messages
- 13
- Programming Experience
- Beginner
Below is My Controller action in the first line I have gotten the student from db and in 5 line I have use service function in which I have passed the student id which will again load the student from db is it good
Controller Action:
public ActionResult DeleteStudentInterest(int studentId, String interestName, string navigateUrl)
{
var student = _studentService.Get(studentId);
// Do some Work
if (savedStudentInterest != null)
{
[B] _applicationService.DeleteStudentInterest(savedStudentInterest, id);
[/B] }
return Redirect(navigateUrl);
}
Service Function:
public void DeleteStudentInterest(string studentInterest, Student student)
{
var student = _db.student.firstordefault(s=>s.Id==id);
// Do Some Work
_db.SaveChanges();
}