/// <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));
        }
        public ActionResult SendOffer(int ID) // open popup on send offer button click
        {
            ProductModel   productModel = iProductRepo.GetProductById(ID);
            ShowOfferModel model        = new ShowOfferModel()
            {
                ProductId  = productModel.Id,
                RecieverID = (int)productModel.AddedByUserId,
            };

            return(PartialView(model));
        }
        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"));
        }
        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"));
        }