public ActionResult DisplayAvailable([Bind(Include = "Breadcrumb,DisplayOnly,CallingAction,CallingController,CallingActionDisplayName,ListingId,ItemDescription,ItemCategory,ItemType,QuantityAvailable,QuantityFulfilled,QuantityOutstanding,UoM,AvailableFrom,AvailableTo,ItemCondition,DisplayUntilDate,SellByDate,UseByDate,DeliveryAvailable,ListingStatus,ListingOrganisationPostcode")] AvailableListingDetailsViewModel model)
        {
            if (Request.Form["resetbutton"] != null)
            {
                return(RedirectToAction("DisplayAvailable", "ManageInfo", new { id = model.ListingId, breadcrumb = model.Breadcrumb, callingActionDisplayName = model.CallingActionDisplayName, displayOnly = model.DisplayOnly, recalled = true, defaultController = model.CallingController, defaultAction = model.CallingAction }));
            }

            if (ModelState.IsValid)
            {
                AvailableListingHelpers.UpdateAvailableListing(db, model, User);
                return(RedirectToAction(model.CallingAction, model.CallingController));
            }

            return(View(model));
        }
        public ActionResult DisplayAvailable([Bind(Include = "MaxDistance,MaxAge,Breadcrumb,DisplayOnly,CallingAction,CallingController,CallingActionDisplayName,ListingId,ItemDescription,ItemCategory,ItemType,QuantityAvailable,QuantityFulfilled,QuantityOutstanding,UoM,AvailableFrom,AvailableTo,ItemCondition,DisplayUntilDate,SellByDate,UseByDate,DeliveryAvailable,ListingStatus,ListingOrganisationPostcode,OfferDescription,OfferId,OfferQty,OfferCounterQty,OfferStatus")] AvailableListingDetailsViewModel model)
        {
            if (Request.Form["resetbutton"] != null)
            {
                return(RedirectToAction("DisplayAvailable", "GeneralInfo", new { id = model.ListingId, breadcrumb = model.Breadcrumb, callingActionDisplayName = model.CallingActionDisplayName, displayOnly = model.DisplayOnly, recalled = true, defaultController = model.CallingController, defaultAction = model.CallingAction, maxDistance = model.MaxDistance, maxAge = model.MaxAge }));
            }

            if (ModelState.IsValid)
            {
                if (Request.Form["saveofferbutton"] != null)
                {
                    OfferHelpers.CreateOffer(db, model.ListingId, model.OfferQty, ListingTypeEnum.Available, null, User);
                }

                if (Request.Form["savebutton"] != null)
                {
                    AvailableListingHelpers.UpdateAvailableListing(db, model, User);
                }

                return(RedirectToAction(model.CallingAction, model.CallingController));
            }

            return(View(model));
        }