Beispiel #1
0
        public ActionResult TransactionSuccessful(string trxref, string reference)
        {
            Transaction Transaction      = new Transaction();
            string      UserId           = LoggedInUser.Id.ToString();
            List <Cart> CartTransactions = CartRepo.GetAll(x => x.CustomerId == UserId).ToList();

            foreach (var item in CartTransactions)
            {
                TransactionRepo.Add(new Transaction()
                {
                    AuctioneeId       = UserId,
                    BatchId           = item.Auction.BatchId,
                    BulkPurchase      = false,
                    DateOfTransaction = DateTime.Now,
                    Quantity          = item.Quantity,
                    TransactionType   = TransactionType.Auction,
                    TotalCost         = item.Auction.AuctionPrice * item.Quantity,
                });

                Batch batch = BatchRepo.Get(x => x.Id == item.Auction.BatchId);
                batch.QuantityAuctioned += item.Quantity;
                BatchRepo.Update(batch);
            }

            Guid[] ids = CartTransactions.Select(x => x.Id).ToArray();

            foreach (var item in ids)
            {
                CartRepo.Delete(item);
            }



            return(View());
        }
Beispiel #2
0
        public ActionResult Edit(BatchViewModel model)
        {
            ResponseResult result = BatchRepo.Update(model);

            return(Json(new
            {
                success = result.Success,
                message = result.ErrorMessage,
                entity = result.Entity
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult Update(BatchViewModel model)
        {
            //if (ModelState.IsValid)
            //{
            ResponResultViewModel result = BatchRepo.Update(model);

            return(Json(new
            {
                success = result.Success,
                message = result.Message,
                entity = result.Entity
            }, JsonRequestBehavior.AllowGet));
        }