Esempio n. 1
0
        public ActionResult Create([Bind(Include = "ItemDescription,ItemType,QuantityRequired,QuantityFulfilled,QuantityOutstanding,UoM,AvailableFrom,AvailableTo,ItemCondition,DisplayUntilDate,SellByDate,UseByDate,DeliveryAvailable,CallingAction,CallingController")] AvailableListingAddView availableListing)
        {
            if (ModelState.IsValid)
            {
                availableListing.ListingStatus = ItemRequiredListingStatusEnum.Open;
                AvailableListingHelpers.CreateAvailableListingFromAvailableListingAddView(availableListing, User);

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

            return(View(availableListing));
        }
Esempio n. 2
0
        // GET: AvailableListings/Create
        public ActionResult Create()
        {
            string callingController = "Home";
            string callingAction     = "Index";

            try
            {
                string[] callingUrlSegments = Request.UrlReferrer.Segments.Select(x => x.TrimEnd('/')).ToArray();
                callingController = callingUrlSegments[callingUrlSegments.Count() - 2];
                callingAction     = callingUrlSegments[callingUrlSegments.Count() - 1];
            }
            catch { }

            ViewBag.CallingController = callingController;

            AvailableListingAddView model = new AvailableListingAddView()
            {
                CallingAction     = callingAction,
                CallingController = callingController
            };

            return(View(model));
        }
Esempio n. 3
0
 public static AvailableListing CreateAvailableListingFromAvailableListingAddView(ApplicationDbContext db, AvailableListingAddView AvailableListingAddView, IPrincipal user)
 {
     return(CreateAvailableListing(db, user, AvailableListingAddView.ItemDescription, AvailableListingAddView.ItemCategory, AvailableListingAddView.ItemType, AvailableListingAddView.QuantityRequired, AvailableListingAddView.UoM, AvailableListingAddView.AvailableFrom, AvailableListingAddView.AvailableTo, AvailableListingAddView.ItemCondition, AvailableListingAddView.DisplayUntilDate, AvailableListingAddView.SellByDate, AvailableListingAddView.UseByDate, AvailableListingAddView.DeliveryAvailable, AvailableListingAddView.ListingStatus));
 }
Esempio n. 4
0
        public static AvailableListing CreateAvailableListingFromAvailableListingAddView(AvailableListingAddView AvailableListingAddView, IPrincipal user)
        {
            ApplicationDbContext db          = new ApplicationDbContext();
            AvailableListing     newCampaign = CreateAvailableListingFromAvailableListingAddView(db, AvailableListingAddView, user);

            db.Dispose();
            return(newCampaign);
        }