Beispiel #1
0
        public ActionResult SubmitAvailableOffer(Guid?listingId, decimal?offerQuantity)
        {
            if (listingId.HasValue && offerQuantity.HasValue)
            {
                if (offerQuantity > 0)
                {
                    AvailableListing availableListing = AvailableListingHelpers.GetAvailableListing(db, listingId.Value);

                    OfferHelpers.CreateOfferForAvailable(db, User, availableListing, offerQuantity.Value);
                }

                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Beispiel #2
0
        public ActionResult Edit([Bind(Include = "ListingId,ItemDescription,ItemType,QuantityRequired,QuantityFulfilled,QuantityOutstanding,UoM,AvailableFrom,AvailableTo,ItemCondition,DisplayUntilDate,SellByDate,UseByDate,DeliveryAvailable,ListingStatus")] AvailableListingEditView availableListing)
        {
            if (ModelState.IsValid)
            {
                //If the 'Submit' button pressed then update tables, else leave as are so that on reload it takes original values once again.
                if (Request.Form["submitbutton"] != null)
                {
                    //Update tables
                    AvailableListingHelpers.UpdateAvailableListingFromAvailableListingEditView(db, availableListing);

                    return(RedirectToAction("Available", "ManageListings"));
                }

                return(RedirectToAction("Edit"));
            }

            //rebuild the missing details before returning to screen to show errors
            AvailableListing listing = AvailableListingHelpers.GetAvailableListing(db, availableListing.ListingId);

            availableListing.ListingAppUser       = AppUserHelpers.GetAppUser(db, listing.ListingOriginatorAppUserId);
            availableListing.ListingBranchDetails = BranchHelpers.GetBranch(db, listing.ListingOriginatorAppUserId);

            return(View(availableListing));
        }