Ejemplo n.º 1
0
 public ActionResult DeleteLot( LotViewModel model)
 {
     var lotid = Convert.ToInt32(Request.Cookies["LotId"].Value);
     if (Auction.DeleteLot(lotid))
     {
         return RedirectToAction("Index", "Home");
     }
     ModelState.AddModelError("","Fail while model deleting.");
     return RedirectToAction("Index", new { id = lotid });
 }
Ejemplo n.º 2
0
 public static bool ToLeaderOnComplete(LotViewModel model)
 {
     //var membershipUser = Membership.GetUser(model.LeaderName);
     //return membershipUser != null && SendEamil(membershipUser.Email, model.Name,
     //                                                                 String.Format(
     //                                                                     "Hello, {0} \r\n Congratulations? you won lot {1} by $ {2}! \r\n " +
     //                                                                     "Wait until you contact the seller",
     //                                                                     model.LeaderName, model.Name, model.Currency));
     return false;
 }
Ejemplo n.º 3
0
 public static bool ToLeaderOnChangedRate(LotViewModel model, string newLeader)
 {
     /*var membershipUser = Membership.GetUser(model.LeaderName);
     return membershipUser != null && SendEamil(membershipUser.Email, model.Name,
                                                                      String.Format(
                                                                          "Hello, {0} \r\n Your bid on lot <a href=\"{1}/Lot/Index/{2}\"> {3} </a>, was broken by <a href=\"{1}/localhost/OnlineAuction/Account/Profile?name={4}\"> {4} </a>",
                                                                          model.LeaderName, LOCAL, model.ID, model.Name, newLeader));
      */
     return false;
 }
Ejemplo n.º 4
0
 public static bool ToOwnerOnComplete(LotViewModel model)
 {
     //var membershipUser = Membership.GetUser(model.OwnerId); //TODO: сделать нормальный поиск пользователей
     //return membershipUser != null && SendEamil(membershipUser.Email, model.Name,
     //                                                                 String.Format(
     //                                                                     "Hello, {0} \r\n Your  lot {1}, was won by the user {2} by $ {4}. \r\n " +
     //                                                                     "Contact them for contacts listed in the user's profile:" +
     //                                                                     " {3}/OnlineAuction/Account/Profile?name={2}",
     //                                                                     model.OwnerName, model.Name,leadername,LOCAL,model.Currency));
     return false;
 }
Ejemplo n.º 5
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});
        }