Ejemplo n.º 1
0
        public void follow(user current, user User, int rate)
        {
            var follower1 = new follower(User, rate);
            current.followers.Add(follower1);
            utOfWork.UserRepository.Update(current);
            utOfWork.Commit();

        }
Ejemplo n.º 2
0
 public void addFollower(follower f)
 {
     utOfWork.FollowersRepository.Add(f);
     utOfWork.Commit();
 }
Ejemplo n.º 3
0
        public ActionResult FollowsList()
        {
            IAdService service = null;
            service = new AdService();
            var user = new user();
            var user1 = new user();
            var user2 = new user();
            var user3 = new user();
            user.username = "******";
            user1.username = "******";
            user2.username = "******";
            user3.username = "******";
        var follower1 = new follower(user1, 10);
        var follower2 = new follower(user2, 5);
        var follower3 = new follower(user3, 7);

        //service.getAds();
         
          user.followers.Add(follower1);      
          user.followers.Add(follower2);
          user.followers.Add(follower3);
            offre offre1 = new offre();
            offre offre2 = new offre();
            offre offre3 = new offre();


            photo photo1 = new photo() ;
            
            photo photo2 = new photo();
            
            photo photo3 = new photo();
            

            offre1.description = "description offre 1 ";
            offre2.description = "description offre 2 description offre 2 description offre 2 description offre 2 description offre 2 ";
            offre3.description = "description offre 3 ";
            offre1.name = "offre1";
            offre2.name = "offre2";
            offre3.name = "offre3";

            product product1 = new product();
            product1.name = "test1";
            product1.description = "test1_discription";
            product1.offre = offre1;
            product1.photo = photo1;
            product1.photo.link = "~/Content/images/products/product01.png";
            product product2 = new product();
            //product1.photo.link.ToString();
            product2.name = "test2";
            product2.description = "test2_discription";
            product2.offre = offre2;
            product2.photo = photo2;
            product2.photo.link = "~/Content/images/products/product02.png";
            product product3 = new product();
            product3.name = "test3";
            product3.description = "test3_discription";
            product3.offre = offre3;
            product3.photo = photo3;
            product3.photo.link = "~/Content/images/products/product03.png";
            
            user1.products.Add(product1);
            user2.products.Add(product2);
            user3.products.Add(product3);
            //user.followers.Add(follower1);


            ViewBag.followers = new SelectList(user.followers, "FollowerId", "Rate");

            return View(user);

        }
Ejemplo n.º 4
0
        // GET: offre1
        public ActionResult Index(string id)
        {

            Home home = new Home();


         
            if (id !=null)
            {
                Session["peerid"] = id;}

            if (Session["session"] == null)
            {
                return RedirectToAction("Index", "User");
            }
        
                 ViewBag.EmployeeName = Session["peerid"];
                 ViewBag.Company = Session["session"];

           
          ViewBag.Company = Session["session"];
          home.offers = offreService.GetOffres().ToList();
        //Followers
          IAdService service = null;
          service = new AdService();
          var user = new user();
          var user1 = new user();
          var user2 = new user();
          var user3 = new user();
          user.username = "******";
          user1.username = "******";
          user2.username = "******";
          user3.username = "******";
          var follower1 = new follower(user1, 10);
          var follower2 = new follower(user2, 5);
          var follower3 = new follower(user3, 7);

          user.followers.Add(follower1);
          user.followers.Add(follower2);
          user.followers.Add(follower3);
          offre offre1 = new offre();
          offre offre2 = new offre();
          offre offre3 = new offre();


          photo photo1 = new photo();

          photo photo2 = new photo();

          photo photo3 = new photo();


          offre1.description = "description offre 1 ";
          offre2.description = "description offre 2 description offre 2 description offre 2 description offre 2 description offre 2 ";
          offre3.description = "description offre 3 ";
          offre1.name = "offre1";
          offre2.name = "offre2";
          offre3.name = "offre3";

          product product1 = new product();
          product1.name = "test1";
          product1.description = "test1_discription";
          product1.offre = offre1;
          product1.photo = photo1;
          product1.photo.link = "~/Content/images/products/product01.png";
          product product2 = new product();
          //product1.photo.link.ToString();
          product2.name = "test2";
          product2.description = "test2_discription";
          product2.offre = offre2;
          product2.photo = photo2;
          product2.photo.link = "~/Content/images/products/product02.png";
          product product3 = new product();
          product3.name = "test3";
          product3.description = "test3_discription";
          product3.offre = offre3;
          product3.photo = photo3;
          product3.photo.link = "~/Content/images/products/product03.png";

          user1.products.Add(product1);
          user2.products.Add(product2);
          user3.products.Add(product3);
          //user.followers.Add(follower1);

          IUser u1 = new UserService();
          user userc = u1.show(((string)Session["session"]).ToLower());
          IProductService prod = new ProductService();
         userc.products=prod.FindProductsByUser(((string)Session["session"]).ToLower()).ToList();

         IFollowerService f = new FollowerService();
           userc.followers= f.GetFollowers(userc.username).ToList();

          ViewBag.followers = new SelectList(userc.followers, "FollowerId", "Rate");

          home.user = user;

            return View(home);
        }