public ActionResult Create([Bind(Include = "id,Name,password,roal")] Login login) { if (ModelState.IsValid) { db.Login.Add(login); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(login)); }
public ActionResult Create([Bind(Include = "id,code,c_Attributs,status")] gcode gcode) { if (ModelState.IsValid) { db.gcode.Add(gcode); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gcode)); }
public ActionResult Create([Bind(Include = "Id,Member_id,Name,standard,room_cup,A_year")] student_data student_data) { if (ModelState.IsValid) { db.student_data.Add(student_data); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student_data)); }
public ActionResult Home(string Reason, int?student_id, DateTime date1, string room_s, string room_sb) { datagstatus a = new datagstatus(); List <object> mymodel = new List <object>(); string user_1 = Session["UserName"].ToString(); if (room_sb == "search") { mymodel.Add(a.student_data.Where(x => x.room_cup.Contains(room_s)).ToList()); mymodel.Add(a.gcode.ToList()); ViewBag.id = new SelectList(a.gcode, "id", "c_Attributs"); } else { mymodel.Add(a.student_data.ToList()); mymodel.Add(a.gcode.ToList()); ViewBag.id = new SelectList(a.gcode, "id", "c_Attributs"); using (var ctx = new datagstatus()) { var studentList = ctx.student_data.SqlQuery("Select * from student_data where Id = " + student_id).ToList(); //var asd = studentList[0].ToString(); //string qwerer = asd[Member_id]; string Member_ID = studentList[0].Member_id.ToString(); string _Name = studentList[0].Name.ToString(); string Room = studentList[0].room_cup.ToString(); string Standard = studentList[0].standard.ToString(); record rec = new record { Member_id = Member_ID, Name = _Name, date = date1, c_Attributs = Reason, user = user_1 }; using (var dbctx = new datagstatus()) { dbctx.record.Add(rec); dbctx.SaveChanges(); } } } ViewBag.reasons = Reason; var month = ""; var day = ""; if (date1.Day < 10) { day = "0" + date1.Day; } else if (date1.Day > 9 && date1.Day < 32) { day = date1.Day.ToString(); } if (date1.Month < 10) { month = "0" + date1.Month; } else if (date1.Month > 9 && date1.Month < 13) { month = date1.Month.ToString(); } ViewBag.date11 = date1.Year + "-" + month + "-" + day; ViewBag.room_ss = room_s; return(View(mymodel)); }