示例#1
0
        public ActionResult Ajax_UpdateEventLead([DataSourceRequest] DataSourceRequest request, vmAdmin_EventLeadItem eventLeadView, int masterEventId)
        {
            if (ModelState.IsValid)
            {
                if (eventLeadView.IsGlobal == 0)
                {
                    eventLeadView.EventId = masterEventId;
                }
                else
                {
                    eventLeadView.EventId = null;
                }

                EventLead eventLead = new EventLead
                {
                    DisplayText     = eventLeadView.DisplayText,
                    EventId         = eventLeadView.EventId,
                    EventLeadId     = eventLeadView.EventLeadId,
                    EventLeadTypeId = eventLeadView.EventLeadTypeId,
                    Title           = eventLeadView.Title
                };

                ServiceResult result = _eventService.UpdateEventLead(eventLead);

                if (!result.Success)
                {
                    Utilities.AddModelStateErrors(this.ModelState, result.GetServiceErrors());
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }
示例#2
0
        public ActionResult Ajax_DeleteEventLead([DataSourceRequest] DataSourceRequest request, vmAdmin_EventLeadItem eventLeadView)
        {
            ServiceResult result = _eventService.RemoveEventLead(eventLeadView.EventLeadId);

            if (!result.Success)
            {
                Utilities.AddModelStateErrors(this.ModelState, result.GetServiceErrors());
            }

            return(Json(ModelState.ToDataSourceResult()));
        }
        public ActionResult Ajax_UpdateEventLead([DataSourceRequest] DataSourceRequest request, vmAdmin_EventLeadItem eventLeadView)
        {
            if (ModelState.IsValid)
            {
                var eventLead = new EventLead
                {
                    DisplayText     = eventLeadView.DisplayText,
                    EventId         = null,
                    EventLeadId     = eventLeadView.EventLeadId,
                    EventLeadTypeId = eventLeadView.EventLeadTypeId,
                    Title           = eventLeadView.Title,
                };

                ServiceResult result = _eventLeadService.UpdateEventLead(eventLead);

                if (!result.Success)
                {
                    Utilities.AddModelStateErrors(ModelState, result.GetServiceErrors());
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }