Ejemplo n.º 1
0
        public ActionResult book_return(int id, string userid, string username, string sl, string bname, string bdate, string rdate, string ratdate, string fine)
        {
            if (!String.IsNullOrEmpty(userid) && !String.IsNullOrEmpty(username))
            {
                var b = service.GetAll().Where(d => d.serialno == sl && d.book_name == bname).FirstOrDefault();
                Ibookreturnservice brservice = servicefactory.getbookreturnservice();
                bookreturn         br        = new bookreturn();
                br.userid      = Convert.ToInt32(userid);
                br.username    = username;
                br.serialno    = sl;
                br.book_name   = bname;
                br.borrow_date = bdate;
                br.return_date = rdate;
                br.return_at   = ratdate;
                br.fine        = Convert.ToInt32(fine);
                brservice.insert(br);

                b.amount = b.amount + 1;
                service.update(b);

                bservice.delete(id);

                ViewBag.msg = "Return successfully done...!!!";
                return(View(br));
            }
            else
            {
                bookreturn br = new bookreturn();
                ViewBag.msg = "Something wrong...!!!";
                return(View(br));
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        // 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));
        }