public string GetImageUrl(int id)
        {
            var  imgUrl = new DataAccess().IndexImageExits(id, "Lots")
                    ? @"Content/Image/Lots/" + id.ToString() + @"/index.jpg"
                    : @"Content/Image/Lots/Default/index.jpg";

            return imgUrl;
        }
예제 #2
0
 public ActionResult SearchBySubCategory(int id)
 {
     var data = new DataAccess();
     var model = new IndexModel()
     {
         Lots = data.SearchLotBySubCategoryId(id)
     };
     return View("Index", model);
 }
예제 #3
0
 public ActionResult Index(IndexModel model = null)
 {
     var dataAccess = new DataAccess();
     if (!String.IsNullOrWhiteSpace(model.SearchQuery))
         return View(new IndexModel()
         {
             Lots = dataAccess.SearchLotByName(model.SearchQuery)
         });
     if (model.Lots == null )
     {
         return View(new IndexModel()
         {
             Lots = dataAccess.GetConvertedActualLotCollection().OrderBy(t =>t.ActualDate)
         });
     }
     else
     {
         return View(model);
     }
 }
 public LotTypePreviewModel(string typeName)
 {
     TypeName = typeName;
     LotTypePreviewCollection = new DataAccess().GetLotTypePreviewCollection(typeName);
 }
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                var createStatus = new DataAccess().AddNewUser(model);
                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName,false);
                    return RedirectToAction("Index", "Home");
                }
                ModelState.AddModelError("", ErrorCodeToString(createStatus));
            }

            // если мы оказались тут, чтото пошло не так, заново отобразить форму
            return View(model);
        }
예제 #6
0
 public HotCatalogModel()
 {
     Lots = new DataAccess().GetHotLots();
 }
예제 #7
0
 public ActionResult AddToBookmarks(LotInfo lotInfo)
 {
     var lotid = Convert.ToInt32(Request.Cookies["LotId"].Value);
     var message = new DataAccess().AddToBookmarks(lotid, HttpContext.User.Identity.Name);
     return RedirectToAction("Index", new { id = lotid, @errormsg = message });
 }
예제 #8
0
 public ActionResult RestoreLot(LotInfo lotInfo)
 {
     var lotid = Convert.ToInt32(Request.Cookies["LotId"].Value);
     var message = new DataAccess().RestoreLot(lotid);
     return RedirectToAction("Index", new { id = lotid, @errormsg=message });
 }
예제 #9
0
        public ActionResult MakeBet(LotViewModel model)
        {
            var lotid = Convert.ToInt32(Request.Cookies["LotId"].Value); //TODO:убрать этот костыль
            var message = "";
            if (ModelState.IsValid)
            {
                message = new DataAccess().MakeBet(HttpContext.User.Identity.Name,lotid, model.BetValue);
                if (String.IsNullOrWhiteSpace(message))
                {
                    return RedirectToAction("Index", new{id=lotid});
                }
                model = new DataAccess().GetViewModelById(lotid);
                ModelState.AddModelError("", message);

            }

            return RedirectToAction("Index", new { id = lotid, @errormsg = message});
        }
예제 #10
0
        public ActionResult LeaveComment(CommentInfo model)
        {
            var id = Convert.ToInt32(Request.Cookies["LotId"].Value);
            var message = "";
            if (ModelState.IsValid)
            {
                message = new DataAccess().LeaveComment(id, HttpContext.User.Identity.Name, model.CommentText);
            }

            return RedirectToAction("Index", new { id = id, @errormsg = message });
        }
예제 #11
0
 public CreateLotModel()
 {
     LotTypeCollection = new DataAccess().GetLotTypeList();
     ActualDate = DateTime.Parse(DateTime.Now.ToShortDateString());
 }
예제 #12
0
 public IndexModel()
 {
     Lots =  new DataAccess().ConvertedActualLotCollection;
 }