Exemplo n.º 1
0
        public IActionResult RemoveItem(string user, string item)
        {
            db = new KissListDBContext();
            klcontroller.RemoveItem(user, item);

            return(View("MyWishList", db));
        }
Exemplo n.º 2
0
        //this method searchs through the DB to find a valid user to display their wishlists
        public IActionResult SearchUser(string username)
        {
            KissListDBContext db = new KissListDBContext();

            var             searchedUser = db.AspNetUsers.SingleOrDefault(u => u.UserName == username);
            List <WishList> list         = new List <WishList>();

            foreach (WishList wishlist in db.WishList)
            {
                if (wishlist.UserName == username)
                {
                    list.Add(wishlist);
                    ViewBag.Name = username;
                }
            }
            if (list.Count == 0 || list == null)
            {
                return(View("nameerror"));
            }
            return(View("~/views/home/UserSearch.cshtml", list));
        }
Exemplo n.º 3
0
        public IActionResult AddWishList(string item, string description, string imageUrl, string url, string price)
        {
            db = new KissListDBContext();


            WishList wishList = new WishList();

            wishList.UserName    = User.Identity.Name;
            wishList.Item        = item;
            wishList.Description = description;
            wishList.ImageUrl    = imageUrl;
            wishList.Url         = url;
            wishList.Price       = price;

            db.WishList.Add(wishList);
            db.SaveChanges();


            return(View("MyWishList", db));
            //return View("index");
        }
Exemplo n.º 4
0
 public IActionResult MyWishList()
 {
     db = new KissListDBContext();
     return(View(db));
 }