public ActionResult SearchAdvanced(String[] arrayIn, String[] arrayNotIn, String nameComic, String status, String author, String nation, String sort) { List <String> listIn = new List <string>(); List <String> listNotIn = new List <string>(); if (arrayIn != null) { listIn = arrayIn.ToList(); } if (arrayNotIn != null) { listNotIn = arrayNotIn.ToList(); } SuperSearch superSearch = new SuperSearch(listIn, listNotIn, Convert.ToInt32(nation), Convert.ToInt32(status), nameComic, author); ComicDAO comicDao = new ComicDAO(); CategoryDAO categoryDao = new CategoryDAO(); StatusComicDAO statusComicDao = new StatusComicDAO(); NationDAO nationDao = new NationDAO(); var comics = comicDao.SearchAdvanced(superSearch, new Pagination(16, Convert.ToInt32(1)), sort); ViewBag.Comics = comics.Comics; ViewBag.Numpage = comics.PageSize; ViewBag.Page = comics.Page; ViewBag.Search = nameComic; ViewBag.Categorys = categoryDao.List().OrderBy(category => category.CategoryId); ViewBag.Status = statusComicDao.ListUser(); ViewBag.Nations = nationDao.List(); ViewBag.ListInAc = listIn; ViewBag.ListNotInAc = listNotIn; ViewBag.AuthorAc = author; ViewBag.SortAc = sort; ViewBag.StatusAc = status; ViewBag.NationAc = nation; return(View()); }
//from them truyen public ActionResult UpComic() { if (_user != null) { CategoryDAO categoryDao = new CategoryDAO(); NationDAO nationDao = new NationDAO(); ViewBag.Nations = nationDao.List(); ViewBag.Categorys = categoryDao.List(); ViewBag.Mss = -1; return(View()); } else { return(Redirect(Url.Action("Login", "User"))); } }
//from them truyen public ActionResult UpComic() { if (CheckStatusUser()) { return(RedirectToAction("Login")); } if (!CheckViewer()) { CategoryDAO categoryDao = new CategoryDAO(); NationDAO nationDao = new NationDAO(); ViewBag.Nations = nationDao.List(); ViewBag.Categorys = categoryDao.List(); ViewBag.Mss = -1; return(View()); } return(RedirectToAction("Index")); }
public ActionResult UpComic(String nameComic, String author, int[] category, int nation, HttpPostedFileBase file, String summary) { if (_user != null) { user user = (user)Session["user"]; List <int> categorys = new List <int>(); if (category != null) { categorys = category.ToList(); } comic comic = new comic(); comic.NationId = nation; comic.UserId = _user.UserId; comic.NameComic = nameComic; comic.AuthorComic = author; comic.SummaryComic = summary; try { ComicDAO comicDao = new ComicDAO(); var add = comicDao.Add(comic, categorys); String path = String.Format("~/Upload/Truyen/{0}", add.ComicId); path = Server.MapPath(path); var a = UploadFile.Upload(file, path, "baner.jpg"); path = String.Format("/Upload/Truyen/{0}/baner.jpg", add.ComicId); comic.CommicBanner = path; var i = comicDao.Update(comic); if (i > 0) { ViewBag.Mss = 1; } else { ViewBag.Mss = 0; } CategoryDAO categoryDao = new CategoryDAO(); NationDAO nationDao = new NationDAO(); ViewBag.Nations = nationDao.List(); ViewBag.Categorys = categoryDao.List(); } catch { ViewBag.Mss = 0; } return(View()); } else { return(Redirect(Url.Action("Login", "User"))); } }