public string UpdateRemainingCredit(AssaignCourse assaignCourse) { if (teacherAssaignGateway.UpdateRemainingCredit(assaignCourse) > 0) { return("Save successful"); } else { return("Save Failed"); } }
public string UpdateTeacherNameInCourse(AssaignCourse assaignCourse) { if (teacherAssaignGateway.UpdateTeacherNameInCourse(assaignCourse) > 0) { return("Save successful"); } else { return("Save Failed"); } }
public ActionResult Save(AssaignCourse assaignCourse) { ViewBag.departments = teacherAssaignManager.GetAllDepartment(); if (ModelState.IsValid) { string message = teacherAssaignManager.Save(assaignCourse); string message1 = teacherAssaignManager.UpdateRemainingCredit(assaignCourse); string message2 = teacherAssaignManager.UpdateTeacherNameInCourse(assaignCourse); ViewBag.Message = message; } return(View()); }
public int UpdateTeacherNameInCourse(AssaignCourse assaignCourse) { string query = "Update TblCourse SET TeacherName=@TeacherName where Id=@id"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@TeacherName", assaignCourse.TeacherName); command.Parameters.AddWithValue("@id", assaignCourse.CourseId); connection.Open(); int rowAffect = command.ExecuteNonQuery(); connection.Close(); return(rowAffect); }
public int UpdateRemainingCredit(AssaignCourse assaignCourse) { string query = "Update TblTeacher SET RemainingCredit=@RemainingCredit where Id=@id"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@RemainingCredit", assaignCourse.RemainingCredit); command.Parameters.AddWithValue("@id", assaignCourse.TeacherId); connection.Open(); int rowAffect = command.ExecuteNonQuery(); connection.Close(); return(rowAffect); }
public string Save(AssaignCourse assaignCourse) { if (teacherAssaignGateway.IsCourseExists(assaignCourse.CourseId)) { return("Course Already Exists"); } else { if (teacherAssaignGateway.Save(assaignCourse) > 0) { return("Save successful"); } else { return("Save Failed"); } } }
public int Save(AssaignCourse assaignCourse) { string query = "INSERT INTO AssaignCourse(DepartmentId,CourseId,Status,TeacherId,RemainingCredit,TeacherName) VALUES " + "(@DepartmentId,@CourseId,@Status,@TeacherId,@RemainingCredit,@TeacherName)"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@DepartmentId", assaignCourse.CourseId); command.Parameters.AddWithValue("@CourseId", assaignCourse.CourseId); command.Parameters.AddWithValue("@Status", 1); command.Parameters.AddWithValue("@TeacherId", assaignCourse.TeacherId); command.Parameters.AddWithValue("@RemainingCredit", assaignCourse.RemainingCredit); command.Parameters.AddWithValue("@TeacherName", assaignCourse.TeacherName); connection.Open(); int rowAffect = command.ExecuteNonQuery(); connection.Close(); return(rowAffect); }