Ejemplo n.º 1
0
        public ActionResult EditEvent(vmAdmin_EditEvent model)
        {
            if (ModelState.IsValid)
            {
                ServiceResult result;

                //The editor widget tries to keep encoding the html on the post, so decode it before it goes in making sure it stays as raw hmtl.
                model.Event.EventDetails = HttpUtility.HtmlDecode(model.Event.EventDetails);

                result = _eventService.UpdateEvent(model.Event);

                if (result.Success)
                {
                    DisplayMessageToUser(new DisplayMessage(DisplayMessageType.SuccessMessage, "This event has been saved successfully"));
                    return(RedirectToAction("EditEvent", new { id = model.Event.EventId }));
                }
                else
                {
                    Utilities.AddModelStateErrors(this.ModelState, result.GetServiceErrors());
                }
            }


            // repopulate the grids..
            model.RegionList       = _eventService.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId);
            model.FeeTypes         = DirtyGirlExtensions.ConvertToSelectList <EventFeeType>();
            model.EventLeadTypes   = Utilities.CreateSelectList(_eventService.GetEventLeadTypes(), value => value.EventLeadTypeId, text => text.TypeName, false);
            model.CouponTypeList   = DirtyGirlExtensions.ConvertToSelectList <CouponType>();
            model.DiscountTypeList = DirtyGirlExtensions.ConvertToSelectList <DiscountType>();
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult EditEvent(int?id)
        {
            vmAdmin_EditEvent vm = new vmAdmin_EditEvent();

            if (id.HasValue)
            {
                vm.Event = _eventService.GetEventById(id.Value) ?? new Event();
            }
            else
            {
                vm.Event = new Event();
            }

            vm.RegionList       = _eventService.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId);
            vm.FeeTypes         = DirtyGirlExtensions.ConvertToSelectList <EventFeeType>();
            vm.EventLeadTypes   = Utilities.CreateSelectList(_eventService.GetEventLeadTypes(), value => value.EventLeadTypeId, text => text.TypeName, false);
            vm.CouponTypeList   = DirtyGirlExtensions.ConvertToSelectList <CouponType>();
            vm.DiscountTypeList = DirtyGirlExtensions.ConvertToSelectList <DiscountType>();

            return(View(vm));
        }