예제 #1
0
        // GET: Profile
        public ActionResult Index(string id)
        {
          
            IOffreService offer = new OffreService();
          
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            user user1 = userService.show(id.ToLower());
           
            if (user1 == null)
            {
                return HttpNotFound();
            }
         

            profile prof = new profile();

            prof.user = user1;
            prof.offre_user = offer.GetOffresByUser(user1.username.ToString()).ToList(); ;

            ViewBag.user=user1.username;
            return View(prof);
            
            
        }
예제 #2
0
 public ActionResult CreateSuggestion(int offreId)
 {
     IOffreService offreService = new OffreService();
     suggestion suggestion = new suggestion { offre_id = offreId };
     List<offre> offres = offreService.GetOffresByUser(((string)Session["session"]).ToLower()).ToList();
     SelectList offreList = new SelectList(offres, "id", "name");
     TempData["OffreList"] = offreList;
    
     return PartialView(suggestion);
 }
예제 #3
0
        // GET: products/Create
        public ActionResult Create()
        {
            IOffreService offreService = new OffreService();
            ICategoryService CategoryService = new CategoryService();
          
            IEnumerable<offre> offres = offreService.GetOffres().ToList();
            offres = offres.Where(off => off.products.Count>0  &&  off.products.FirstOrDefault().owner_username.ToLower().Equals(((string)(Session["session"])).ToLower())).ToList();
            product product = new product { creationdate = DateTime.Now.Date };

            IEnumerable<category> categories = CategoryService.GetCategories().ToList();
            //categories = CategoryService.GetAllCategory().ToList();
            SelectList selectList = new SelectList(offres,"id", "name");
            product.owner_username = (string)(Session["session"]);
            SelectList selectList1 = new SelectList(categories, "id", "name");
            ViewData["offreList"] = selectList;
            ViewData["categoryList"] = selectList1;
                       return View(product);
        }
예제 #4
0
        // GET: products/Edit/5
        public ActionResult Edit(long id)
        {
            IOffreService offreService = new OffreService();
            ICategoryService CategoryService = new CategoryService();
          
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            IEnumerable<offre> offres = offreService.GetOffres().ToList();
            offres = offres.Where(off => off.products.Count > 0 && off.products.FirstOrDefault().owner_username.ToLower().Equals(((string)(Session["session"])).ToLower())).ToList();
           

            IEnumerable<category> categories = CategoryService.GetCategories().ToList();
             
            SelectList selectList = new SelectList(offres, "id", "name");

            SelectList selectList1 = new SelectList(categories, "id", "name");
            ViewData["offreList"] = selectList;
            ViewData["categoryList"] = selectList1;
            product product = productServicce.FindProductById(id);
            if (product == null)
            {
                return HttpNotFound();
            }
            return View(product);
        }