// 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); }
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); }
// 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); }
// 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); }