Пример #1
0
 /// <summary>
 /// 添加到收藏夹
 /// </summary>
 /// <returns></returns>
 public ActionResult AddToCollection(int carid)
 {
     var session = Session["logID"];
     if (session == null)
     {
         return RedirectToAction("Login");
     }
     else
     {
         int userid = Int32.Parse(session.ToString());
         CollectionModel model = new CollectionModel();
         model.CarID = carid;
         model.UserInfo_ID = userid;
         ICollectionDal dal = new CollectionDal();
         dal.AddCollection(model);
         return RedirectToAction("MyCollection");
     }
 }
Пример #2
0
 public ActionResult MyCollection()
 {
     var session = Session["logID"];
     if (session == null)
     {
         return RedirectToAction("Login");
     }
     else
     {
         int userid = Int32.Parse(session.ToString());
         ICollectionDal dal = new CollectionDal();
         List<CollectionModel> list = dal.GetCollectionsByUserId(userid);
         return View(list);
     }
 }
Пример #3
0
 public ActionResult DeleteCollection(int id)
 {
     ICollectionDal dal=new CollectionDal();
     int result=dal.RemoveCollection(id);
     if (result==1)
     {
         return RedirectToAction("MyCollection");
     }
     else
     {
         return RedirectToAction("Failed", "PageHelper");
     }
 }