Пример #1
0
        /// <summary>
        /// Send counter offer to user vice versa
        /// </summary>
        /// <param name="OfferID"> offer id </param>
        /// <returns>Show send offer popup using SendOffer.cshtml view</returns>
        public ActionResult SendCounterOffer(int OfferID)
        {
            ProductOfferModel model = iProductOfferRepo.GetofferByID(OfferID);

            if (model.Counter == null) // first counter means first barganing
            {
                model.Counter = 1;
            }
            else
            {
                model.Counter += 1; // not first counter
            }
            ShowOfferModel showOfferModel = new ShowOfferModel()
            {
                ID         = model.OfferId,
                OfferPrice = model.OfferPrice,
                SenderID   = model.ReceiverId,
                RecieverID = model.SenderId,
                ProductId  = model.ProductId,
                Status     = model.Status,
                Message    = model.Message,
                Counter    = model.Counter,
            };

            return(PartialView(showOfferModel));
        }
Пример #2
0
        public ActionResult SendCounterOffer(ShowOfferModel model)
        {
            ProductOfferModel productOfferModel = new ProductOfferModel()
            {
                OfferId    = model.ID,
                OfferPrice = model.OfferPrice,
                SenderId   = model.SenderID,
                ReceiverId = model.RecieverID,
                ProductId  = model.ProductId,
                Status     = model.Status,
                Message    = model.Message,
                Counter    = model.Counter,
            };

            iProductOfferRepo.SaveOffer(productOfferModel);
            return(RedirectToAction("Index", "Home"));
        }
Пример #3
0
        public void UpdateOffer(ProductOfferModel objProductOfferModel) // save offer data and returns int value
        {
            tblOfferPrice tblOffer = new tblOfferPrice()
            {
                OfferId    = objProductOfferModel.OfferId,
                OfferPrice = objProductOfferModel.OfferPrice,
                SenderId   = objProductOfferModel.SenderId,
                ReceiverId = objProductOfferModel.ReceiverId,
                Product_Id = objProductOfferModel.ProductId,
                Message    = objProductOfferModel.Message,
                Status     = objProductOfferModel.Status,
                Counter    = objProductOfferModel.Counter,
            };

            objWITSProjectEntities.Set <tblOfferPrice>().AddOrUpdate(tblOffer);
            objWITSProjectEntities.SaveChanges();
        }
Пример #4
0
        public ProductOfferModel GetofferByID(int ID)  // get all offers
        {
            var objProductOfferModel            = objWITSProjectEntities.tblOfferPrice.Where(p => p.OfferId == ID).FirstOrDefault();
            ProductOfferModel productOfferModel = new ProductOfferModel()
            {
                OfferId    = objProductOfferModel.OfferId,
                OfferPrice = (int)objProductOfferModel.OfferPrice,
                SenderId   = objProductOfferModel.SenderId,
                ReceiverId = objProductOfferModel.ReceiverId,
                ProductId  = objProductOfferModel.Product_Id,
                Status     = objProductOfferModel.Status,
                Message    = objProductOfferModel.Message,
                Counter    = objProductOfferModel.Counter,
            };

            return(productOfferModel);
        }
Пример #5
0
        public ActionResult SendOffer(ShowOfferModel showOfferModel) // open popup on send offer button click
        {
            //var product = iProductRepo.GetProductById(showOfferModel.ProductId);
            ProductOfferModel productOfferModel = new ProductOfferModel()
            {
                OfferId    = showOfferModel.ID,
                OfferPrice = showOfferModel.OfferPrice,
                SenderId   = showOfferModel.SenderID,
                ReceiverId = showOfferModel.RecieverID,
                ProductId  = showOfferModel.ProductId,
                Status     = showOfferModel.Status,
                Message    = showOfferModel.Message,
                Counter    = showOfferModel.Counter,
            };

            iProductOfferRepo.SaveOffer(productOfferModel);
            return(RedirectToAction("Index", "Home"));
        }
Пример #6
0
        /// <summary>
        /// ShowNotification method action control
        /// </summary>
        /// <param name="OfferID"> Offer id of offer</param>
        /// <param name="OfferStatus"> value based of button click </param>
        /// <returns>value of cliked button</returns>
        public string OfferActions(int OfferID, bool OfferStatus) // action button mehod of offer notification
        {
            string offerStatus = "";

            if (OfferStatus == true)
            {
                ProductOfferModel productOfferModel  = iProductOfferRepo.GetofferByID(OfferID); //get offer by id
                ProductOfferModel productOfferModel1 = new ProductOfferModel()
                {
                    OfferId    = productOfferModel.OfferId,
                    OfferPrice = productOfferModel.OfferPrice,
                    SenderId   = productOfferModel.SenderId,
                    ReceiverId = productOfferModel.ReceiverId,
                    ProductId  = productOfferModel.ProductId,
                    Status     = OfferStatus,
                    Message    = productOfferModel.Message
                };

                iProductOfferRepo.UpdateOffer(productOfferModel1);
                return(offerStatus = "true");
            }
            else
            {
                ProductOfferModel productOfferModel  = iProductOfferRepo.GetofferByID(OfferID);
                ProductOfferModel productOfferModel1 = new ProductOfferModel()
                {
                    OfferId    = productOfferModel.OfferId,
                    OfferPrice = productOfferModel.OfferPrice,
                    SenderId   = productOfferModel.SenderId,
                    ReceiverId = productOfferModel.ReceiverId,
                    ProductId  = productOfferModel.ProductId,
                    Status     = OfferStatus,
                    Message    = productOfferModel.Message
                };
                iProductOfferRepo.UpdateOffer(productOfferModel1);
                return(offerStatus = "false");
            }
        }