public ActionResult Create(EventScheduleManageModel model, SubmitType submit)
        {
            if (ModelState.IsValid)
            {
                var response = _eventScheduleService.SaveEventSchedule(model);
                SetResponseMessage(response);
                if (response.Success)
                {
                    var eventScheduleId = (int)response.Data;
                    switch (submit)
                    {
                    case SubmitType.Save:
                        return(RedirectToAction("Index"));

                    case SubmitType.SaveAndContinueEdit:
                        return(RedirectToAction("Edit", new { id = eventScheduleId }));
                    }
                }
            }
            return(View(model));
        }
Exemple #2
0
        /// <summary>
        /// Save new event from event create model
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel SaveEvent(EventCreateModel model)
        {
            // Save Event
            var saveEventResponse = SaveEvent(model.Event);

            // If save Event success, save EventSchedule
            if (saveEventResponse.Success)
            {
                var eventId = (int)saveEventResponse.Data;
                model.EventSchedule.EventId = eventId;

                var saveEventScheduleResponse = _eventScheduleService.SaveEventSchedule(model.EventSchedule);
                return(saveEventScheduleResponse.Success ? saveEventResponse : saveEventScheduleResponse);
            }
            return(saveEventResponse);
        }