コード例 #1
0
 public static bool ToLeaderOnChangedRate(LotModel 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));
 }
コード例 #2
0
 public static bool ToOwnerOnComplete(LotModel model)
 {
     var membershipUser = Membership.GetUser(model.OwnerName);
     return membershipUser != null && SendEamil(membershipUser.Email, model.Name,
                                                                      String.Format(
                                                                          "Hello, {0} \r\n Sorry, but your  lot {1}, was removed from the auction. \r\n " ,
                                                                          model.OwnerName, model.Name));
 }
コード例 #3
0
ファイル: Auction.cs プロジェクト: DzmitryLvov/OnlineAuction
 public static void MakeBet(LotModel model, string username)
 {
     if (model.LeaderName != null && username != model.LeaderName)
     {
         EmailSender.ToLeaderOnChangedRate(model, username);
     }
     dataAccess.MakeBet(model.ID, username, model.Currency);
 }
コード例 #4
0
 public static bool ToLeaderOnComplete(LotModel 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));
 }
コード例 #5
0
 public ActionResult DeleteLot( LotModel Model)
 {
     if (Auction.DeleteLot(Model))
     {
         return RedirectToAction("Index", "Home");
     }
     ModelState.AddModelError("","Fail while model deleting.");
     return Index(Model);
 }
コード例 #6
0
 public static bool ToOwnerOnComplete(LotModel model, string leadername)
 {
     var membershipUser = Membership.GetUser(model.OwnerName);
     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));
 }
コード例 #7
0
        public ActionResult Index(LotModel model )
        {
            if (ModelState.IsValid)
            {
                Auction.MakeBet(model, HttpContext.User.Identity.Name);
                return RedirectToAction("Index", "Lot",new {id = model.ID});
            }
            var restoreModel = dataAccess.GetViewModelById(model.ID);

            return View(restoreModel);
        }
コード例 #8
0
ファイル: Auction.cs プロジェクト: DzmitryLvov/OnlineAuction
        public static bool DeleteLot(LotModel currentLot)
        {
            try
            {
                if (currentLot.LeaderName != null)
                {
                    EmailSender.ToOwnerOnComplete(currentLot, currentLot.LeaderName);
                    EmailSender.ToLeaderOnComplete(currentLot);
                }
                else
                {
                    EmailSender.ToOwnerOnComplete(currentLot);
                }
                dataAccess.DeleteLot(currentLot.ID);

                return true;
            }
            catch (ArgumentException)
            {
                return false;
            }
        }
コード例 #9
0
 public LotModel ConvertToViewModel(Lot lot)
 {
     var model = new LotModel
         {
             ID = lot.ID,
             ActualDate = lot.ActualDate,
             Currency = lot.Currency,
             Description = lot.Description,
             Name = lot.Lotname,
             LeaderName = lot.LeaderName,
             OwnerName = lot.OwnerName
         };
     return model;
 }