Beispiel #1
0
        public ActionResult EditStoreByTrackId(string id)
        {
            #region validate request
            var user = GetCurrentUser();

            var isBelong2Owner = _webStoreServices.ValidateOwnerStoreByTrackingId(user.userId, id);

            if (!isBelong2Owner)
            {
                return(RedirectToAction("NonAuthorized", "Error"));
            }
            #endregion

            var store = _webStoreServices.FindStoreByTrackingId(user.userId, id);

            var token = new EditWebStorePageToken
            {
                user    = user
                , store = store
                , mode  = store.id < 0 ? CommonEnums.ePageMode.insert : CommonEnums.ePageMode.edit
                , title = store.id < 0 ? "Create New WebStore" : "Edit " + store.name
            };

            return(View("EditStore", token));
        }
Beispiel #2
0
        public ActionResult AdminEditStore(Guid id, int userId)
        {
            #region validate request
            if (!IsAdminRequestAuthorized())
            {
                return(RedirectToAction("NonAuthorized", "Error"));
            }
            #endregion

            var user = BaseAuthorServices.FindUsers(userId, null, null).FirstOrDefault();

            var store = _webStoreServices.FindStoreByUid(userId, id);

            if (user != null)
            {
                var token = new EditWebStorePageToken
                {
                    user          = user
                    , ownerUserId = user.userId
                    , store       = store
                    , mode        = store.id < 0 ? CommonEnums.ePageMode.insert : CommonEnums.ePageMode.edit
                    , title       = store.id < 0 ? "Create New WebStore" : "Edit " + store.name
                };

                return(View("AdminEditUserWebStore", token));
            }


            return(View("AdminEditUserWebStore", new EditWebStorePageToken {
                title = "User not found"
            }));
        }
Beispiel #3
0
        public ActionResult EditLfeStore()
        {
            #region validate request
            if (!IsAdminRequestAuthorized())
            {
                return(RedirectToAction("NonAuthorized", "Error"));
            }
            #endregion

            var user  = BaseAuthorServices.FindUsers(Constants.LFE_MAIN_STORE_OWNER_ID, null, null).FirstOrDefault();
            var store = _webStoreServices.FindStoreByTrackingId(Constants.LFE_MAIN_STORE_OWNER_ID, Constants.LFE_MAIN_STORE_TRACKING_ID);

            var token = new EditWebStorePageToken
            {
                user = user
                       // ReSharper disable once PossibleNullReferenceException
                , ownerUserId = user.userId
                , store       = store
                , mode        = store.id < 0 ? CommonEnums.ePageMode.insert : CommonEnums.ePageMode.edit
                , title       = store.id < 0 ? "Create New WebStore" : "Edit " + store.name
            };

            return(View("LfeMainStoreManage", token));
        }