예제 #1
0
 public void UpdateAuctionHouseSale(AuctionHouseSale auctionHouseSale)
 {
     if (auctionHouseSale == null)
         throw new ArgumentNullException("auctionHouseSale");
     else
     {
         AuctionHouseSale result = _auctionHouseSaleRepository.GetById(auctionHouseSale.AuctionHouseSaleID);
         result.AuctionHouseSaleID = auctionHouseSale.AuctionHouseSaleID;
         result.SaleDate = auctionHouseSale.SaleDate;
         result.Title = auctionHouseSale.Title;
           _auctionHouseSaleRepository.Update(result);
     }
 }
예제 #2
0
 public void InsertAuctionHouseSale(AuctionHouseSale auctionHouseSale)
 {
     if (auctionHouseSale == null)
         throw new ArgumentNullException("auctionHouseSale");
     _auctionHouseSaleRepository.Insert(auctionHouseSale);
 }
        public ActionResult AddNewAuctionHouse(AuctionHouseAddEditVehicleModel model)
        {
            AuctionHouseSale obj = new AuctionHouseSale();

            if (!string.IsNullOrEmpty(model.NewSaleDate))
                obj.SaleDate = DateTime.ParseExact(model.NewSaleDate, "dd/MM/yyyy", null).ToUniversalTime();

            string UserName = Request.RequestContext.HttpContext.User.Identity.Name;
            var UserDetails = _aspNetUserService.GetAspNetUserByUserName(UserName);
            long userid = UserDetails.AspNetUsersAdditionalInfoes.FirstOrDefault().ID;

            var AuctionHouseDetails = _auctionHouseService.GetAllAuctionDetails().Where(t => t.UserID == userid).FirstOrDefault();

            obj.AuctionHouseID = AuctionHouseDetails.AuctionHouseID;

            obj.Title = model.Title;

            PopulateSaleDate objSale = new PopulateSaleDate();
            var varSaleTitle = _auctionHouseSaleService.GetAuctionHouseSale().Where(t => t.Title == model.Title).ToList();
            if (varSaleTitle.Count==0)
            {
                _auctionHouseSaleService.InsertAuctionHouseSale(obj);

                objSale.AuctionHouseSaleID = obj.AuctionHouseSaleID;
                objSale.Title = obj.Title;
                objSale.msg = "success";
            }
            else {
                objSale.msg = "duplicate Title!Enter different Title";

            }

            return Json(objSale, JsonRequestBehavior.AllowGet);
        }