public string Save(SaveCourseModel course) { int rowEffect = saveCourseGateway.Save(course); if (rowEffect > 0) { return("Save Successful"); } else { return("Save Faild"); } }
public ActionResult Save(SaveCourseModel course) { ViewBag.Title = "Save Course"; ViewBag.departments = saveCourseManager.DepartmentDropDownlist(); ViewBag.semesters = saveCourseManager.SemesterDropDownlist(); if (saveCourseManager.IsCodeExists(course.Code) == false) { ViewBag.message = saveCourseManager.Save(course); } else { ViewBag.message = "Already Exist"; } return(View()); }
public int Save(SaveCourseModel course) { query = "INSERT INTO SaveCoursesTable VALUES(@Code,@Name,@Credit,@Description,@DepartmentID,@SemesterID)"; Command = new SqlCommand(query, Connection); Command.Parameters.AddWithValue("@Code", course.Code); Command.Parameters.AddWithValue("@Name", course.Name); Command.Parameters.AddWithValue("@Credit", course.Credit); Command.Parameters.AddWithValue("@Description", course.Description); Command.Parameters.AddWithValue("@DepartmentID", course.DepartmentID); Command.Parameters.AddWithValue("@SemesterID", course.SemesterID); Connection.Open(); int rowEffect = Command.ExecuteNonQuery(); Connection.Close(); return(rowEffect); }