Esempio n. 1
0
        public IActionResult Checkout(String CopyId, String BookId, String MemberId)
        {
            //copy has to be populated
            // var context = new BookishContext();
            // var copy = context.Copies_Book_Member
            //                     .Where(s => s.CopyId == Int32.Parse(CopyId))
            //                     .ToList()

            var copy = new Copy()
            {
                CopyId = Int32.Parse(CopyId), BookId = Int32.Parse(BookId)
            };

            // MemberId = Int32.Parse(MemberId), IssueDate = DateTime.Now, DueDate = DateTime.Now.AddDays(14)

            copy.MemberId  = Int32.Parse(MemberId);
            copy.IssueDate = DateTime.Now;
            copy.DueDate   = DateTime.Now.AddDays(14);

            using (var context = new BookishContext())
            {
                context.Update <Copy>(copy);
                context.SaveChanges();
            }

            return(RedirectToAction("FindCopies"));
        }
Esempio n. 2
0
        public IActionResult ReturnB(String CopyId, String BookId)
        {
            var copy = new Copy()
            {
                CopyId = Int32.Parse(CopyId), BookId = Int32.Parse(BookId)
            };

            copy.MemberId  = null;
            copy.IssueDate = null;
            copy.DueDate   = null;

            using (var context = new BookishContext())
            {
                context.Update <Copy>(copy);
                context.SaveChanges();
            }

            return(RedirectToAction("FindCopies"));
        }
Esempio n. 3
0
        public IActionResult MemberChange(String MemberId, String Name, String ContactNo, String Email)

        {
            var member = new Member()
            {
                MemberId = Int32.Parse(MemberId)
            };

            member.Name      = Name;
            member.ContactNo = ContactNo;
            member.Email     = Email;


            using (var context = new BookishContext())
            {
                context.Update <Member>(member);
                context.SaveChanges();
            }

            return(RedirectToAction("MemberList"));
        }