public ActionResult uPanel(string searchString) { IEnumerable <book> a = service.GetAll(); if (!String.IsNullOrEmpty(searchString)) { a = from c in a where c.book_name.ToUpper().Contains(searchString.Trim().ToUpper()) || c.author.ToUpper().Contains(searchString.Trim().ToUpper()) select c; //var det = db.products.ToList(); List <bookmodel> viewlist = new List <bookmodel>(); foreach (book b in a) { bookmodel book = new bookmodel() { id = b.id, serialno = b.serialno, book_name = b.book_name, author = b.author, edition = b.edition, shelf = b.shelf, amount = b.amount }; viewlist.Add(book); } return(View(viewlist)); } else { return(RedirectToAction("uPanel")); } }
public ActionResult uPanel() { /* int uid = Convert.ToInt32(userid); * user u = uservice.Get(uid);*/ Ibookservice service = servicefactory.getbookservice(); IEnumerable <book> booklist = service.GetAll(); List <bookmodel> viewlist = new List <bookmodel>(); foreach (book b in booklist) { bookmodel book = new bookmodel() { id = b.id, serialno = b.serialno, book_name = b.book_name, author = b.author, edition = b.edition, shelf = b.shelf, amount = b.amount }; viewlist.Add(book); } return(View(viewlist)); }
public ActionResult update(FormCollection fc) { ViewBag.Message = "Your contact page."; bookmodel a = new bookmodel(Convert.ToInt32(fc["bkid"]), (fc["title"])); bookmodel.update(a); return(View("show")); }
// GET: book public ActionResult Index() { Ibookservice service = servicefactory.getbookservice(); IEnumerable <book> booklist = service.GetAll(); List <bookmodel> viewlist = new List <bookmodel>(); foreach (book b in booklist) { bookmodel book = new bookmodel() { id = b.id, serialno = b.serialno, book_name = b.book_name, author = b.author, edition = b.edition, shelf = b.shelf, amount = b.amount }; viewlist.Add(book); } return(View(viewlist)); }