Beispiel #1
0
        public async Task <ActionResult> AddGroupEvent(AddEditGroupEventViewModel model)
        {
            if (model.AppID != 0)
            {
                model.GroupEvent.AddProduct(siteService.GetProductByAppID(model.AppID));
            }
            else if (String.IsNullOrEmpty(model.Product.ProductName) == false)
            {
                model.GroupEvent.AddProduct(model.Product);
            }
            else if (model.GroupEvent?.ProductID != 0)
            {
                model.GroupEvent.AddProduct(siteService.GetProductByID((int)model.GroupEvent.ProductID));
            }

            model.GroupEvent.AppUser = await siteService.GetAppUserByID(model.GroupEvent.AppUserID);

            model.LoggedInUser = await siteService.GetCurrentUser();

            model.FullNavList = CreateHomeAdminNavList();

            if (ModelState.IsValid)
            {
                siteService.AddGroupEvent(model.GroupEvent);
            }
            else
            {
                return(View(model));
            }

            model.GroupEvent = siteService.GetGroupEventByID(model.GroupEvent.GroupEventID);

            return(View("EditGroupEvent", model));
        }
Beispiel #2
0
        public async Task <ActionResult> EditGroupEvent(AddEditGroupEventViewModel model)
        {
            Product product = new Product();

            if (model.AppID != 0)
            {
                product = siteService.GetProductByAppID(model.AppID);
            }
            else if (String.IsNullOrEmpty(model.Product.ProductName) == false)
            {
                product = model.Product;
            }
            else if (model.GroupEvent?.ProductID != 0)
            {
                product = siteService.GetProductByID((int)model.GroupEvent.ProductID);
            }

            if (ModelState.IsValid)
            {
                siteService.EditGroupEvent(model.GroupEvent, product);
            }

            model.LoggedInUser = await siteService.GetCurrentUser();

            model.FullNavList = CreateHomeAdminNavList();

            ModelState.Clear();

            return(View(model));
        }
Beispiel #3
0
        public async Task <ActionResult> AddGroupEvent(string id)
        {
            AddEditGroupEventViewModel model = new AddEditGroupEventViewModel();

            model.GroupEvent.AppUserID = id;
            model.LoggedInUser         = await siteService.GetCurrentUser();

            model.FullNavList = CreateHomeAdminNavList();

            return(View(model));
        }
Beispiel #4
0
        public async Task <ActionResult> EditGroupEvent(int id)
        {
            AddEditGroupEventViewModel model = new AddEditGroupEventViewModel();

            model.GroupEvent   = siteService.GetGroupEventByID(id);
            model.LoggedInUser = await siteService.GetCurrentUser();

            model.FullNavList = CreateHomeAdminNavList();

            if (model.GroupEvent == null)
            {
                return(View("AdminGroupEvents"));
            }

            return(View(model));
        }