public ActionResult QuanLyTruyenDaTao() { if (!CheckSS()) { return(RedirectToAction("DangNhap", "User")); } else { NguoiDung nguoi = (NguoiDung)Session["TaiKhoan"]; List <TruyenDaTao> truyens = new List <TruyenDaTao>(); var listtruyen = data.Truyens.Where(n => n.MaNguoiDung == nguoi.MaNguoiDung && n.DaXoa == false).ToList().OrderByDescending(a => a.NgayTao); foreach (var truyen in listtruyen) { TruyenDaTao truyen1 = new TruyenDaTao(); truyen1.MaProject = truyen.MaProject; truyen1.AnhBia = truyen.AnhBia; truyen1.TenTruyen = truyen.TenProject; truyen1.TacGia = truyen.TacGia; truyen1.TrangThai = truyen.TrangThai1.TenTrangThai; truyen1.NgayTao = truyen.NgayTao.ToShortDateString(); truyens.Add(truyen1); } return(View(truyens)); } }
public ActionResult DanhSachTruyen() { List <TruyenDaTao> truyens = new List <TruyenDaTao>(); var listtruyen = data.Truyens.ToList(); foreach (var truyen in listtruyen) { TruyenDaTao truyen1 = new TruyenDaTao(); truyen1.MaProject = truyen.MaProject; truyen1.AnhBia = truyen.AnhBia; truyen1.TenTruyen = truyen.TenProject; truyen1.TacGia = truyen.TacGia; truyen1.TrangThai = truyen.TrangThai1.TenTrangThai; truyen1.NgayTao = truyen.NgayTao.ToShortDateString(); truyens.Add(truyen1); } return(View(truyens)); }