public void AsgnClsSub(ClassesOrSubjectsToTeacher cs, int id) { SqlCommand cmd = new SqlCommand("INSERT into asgnd_cls_sbjcts_to_tchr (T_id,classsubject_id,date,month,year,time) VALUES (@T_id,@CS_id,@Date,@Month,@Year,@Time)", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@T_id", id); cmd.Parameters.AddWithValue("@CS_id", (cs.Class_subject_id == null) ? Convert.DBNull : cs.Class_subject_id); cmd.Parameters.AddWithValue("@Date", (cs.Date == null) ? Convert.DBNull : cs.Date); cmd.Parameters.AddWithValue("@Month", (cs.Month == null) ? Convert.DBNull : cs.Month); cmd.Parameters.AddWithValue("@Year", (cs.Year == null) ? Convert.DBNull : cs.Year); cmd.Parameters.AddWithValue("@Time", (cs.Time == null) ? Convert.DBNull : cs.Time); Teacher(cmd); }
public ActionResult AsignClsSub(ClassOrSubjectToTeacher Add, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { ClassesOrSubjectsToTeacher AsgnClsSub = new ClassesOrSubjectsToTeacher(); AsgnClsSub.Class_subject_id = Add.Class_subject_id; AsgnClsSub.Date = DateTime.Today.ToString("dd-MM-yyyy"); AsgnClsSub.Month = DateTime.Today.ToString("MMM"); AsgnClsSub.Year = DateTime.Today.ToString("yyyy"); AsgnClsSub.Time = DateTime.Now.ToString("HH:mm:ss"); new Cateloge().AddAsgndClsSub(AsgnClsSub, id); TempData["Msg"] = "New Subject Have Asigned Successfully"; return(RedirectToAction("View", new { id = id })); } return(View(Add)); } }
public void AddAsgndClsSub(ClassesOrSubjectsToTeacher cs, int id) { new AddAndUpdtTeacherDAL().AsgnClsSub(cs, id); }