public List <Thongke_lhs_time_class> Thongke_LHS_time(int year) { LUUHS lhs = new LUUHS(); SqlParameter endDate = new SqlParameter("@date", year); endDate.SqlDbType = SqlDbType.Int; return(lhs.Database.SqlQuery <Thongke_lhs_time_class>("exec dbo.ThongKe_LHS_ThoiGian @date", endDate).ToList()); }
public ActionResult DetailLHS(string MALHS) { LUUHS lhs = new LUUHS(); F_Luuhocsinh f_lhs = new F_Luuhocsinh(); var detaillhs = f_lhs.Detai_LHS_Ma(MALHS); ViewBag.Doituong = lhs.DoiTuongs.Where(x => x.MaDoiTuong != 0).ToList(); return(View(detaillhs)); }
public bool ChangeImageLHS(string id, string image) { using (var db = new LUUHS()) { var result = db.LuuHocSinhs.SingleOrDefault(b => b.MaLHS == id); if (result != null) { result.Image = image; db.SaveChanges(); } } return(true); }
public bool AddNewLHS(LuuHocSinh lhs) { using (LUUHS luuhs = new LUUHS()) { try { luuhs.LuuHocSinhs.Add(lhs); luuhs.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
/// <summary> /// Thêm mới lưu học sinh(trang view) /// </summary> /// <returns></returns> public ActionResult AddNewLHS() { LUUHS lhs = new LUUHS(); var count = lhs.LuuHocSinhs.Count(); string malhs = "SV" + DateTime.UtcNow.Year; if (count < 100 && count > 10) { malhs += "0"; } else if (count > 0 && count < 10) { malhs += "00"; } else { } ViewBag.malhs = malhs + count; ViewBag.Doituong = lhs.DoiTuongs.Where(x => x.MaDoiTuong != 0).ToList(); return(View()); }