public ActionResult AddAllCustomerEventsPopup(string btnId, string formId, AddCustomerEventViewModel model) { //Event model.CameleoEvent = _eventService.GetEventViewModel(model.CameleoEvent.Id); //Get event users for this group model.CameleoEventUserList = _eventUserService.GetEventUserListViewModel(model.CameleoEvent.Id, model.GroupName); //Get customer events for this group model.CameleoCustomerEventList = _customerEventService.GetCustomerEventListViewModel(model.CameleoEvent.Id, model.GroupName); ModelState.Clear(); var tmpCustomer = _customerService.GetCustomerByUsername(model.CameleoEvent.EventCode); if (tmpCustomer == null) { //No customer found with the specified username ModelState.AddModelError("", _localizationService.GetResource("Nop.Plugin.Cameleo.CameleoEvents.Views.Admin.AddCustomerEventPopup.UnknownCustomer")); } if (ModelState.IsValid) { //for all event users foreach (var tmpEventUser in model.CameleoEventUserList.CameleoEventUserList) { //Event user already there for this customer? if (_customerEventService.GetCustomerEvent(tmpEventUser.Id, tmpCustomer.Id) == null) { //No, add it _customerEventService.InsertCustomerEvent(tmpEventUser.Id, tmpCustomer.Id, (int)AcceptedStatus.AcceptedPaid, false, true); } } } if (ModelState.IsValid) { //Close popup and refresh list ViewBag.RefreshPage = true; ViewBag.btnId = btnId; ViewBag.formId = formId; return(View("~/Plugins/Cameleo.CameleoEvents/Views/Admin/CustomerEvent/AddAllCustomerEventsPopup.cshtml", model)); } //If we got this far, something failed, redisplay form return(View("~/Plugins/Cameleo.CameleoEvents/Views/Admin/CustomerEvent/AddAllCustomerEventsPopup.cshtml", model)); }
public ActionResult AddCustomerEventPopup(string btnId, string formId, AddCustomerEventViewModel model) { //Event model.CameleoEvent = _eventService.GetEventViewModel(model.CameleoEvent.Id); //Get user events for this group model.CameleoEventUserList = _eventUserService.GetEventUserListViewModel(model.CameleoEvent.Id, model.GroupName); //Get customer events for this group model.CameleoCustomerEventList = _customerEventService.GetCustomerEventListViewModel(model.CameleoEvent.Id, model.GroupName); ModelState.Clear(); var tmpCustomer = _customerService.GetCustomerByUsername(model.AddedCustomerEventUserName); if (tmpCustomer == null) { //No customer found with the specified username ModelState.AddModelError("", _localizationService.GetResource("Nop.Plugin.Cameleo.CameleoEvents.Views.Admin.AddCustomerEventPopup.UnknownCustomer")); } if (ModelState.IsValid) { //Event user already there for this customer? if (_customerEventService.GetCustomerEvent(model.AddedEventUserId, tmpCustomer.Id) != null) { //Yes,display message ModelState.AddModelError("", _localizationService.GetResource("Nop.Plugin.Cameleo.CameleoEvents.Views.Admin.AddCustomerEventPopup.CustomerEventExists")); } } if (ModelState.IsValid) { //Everything is fine //Add the customer event _customerEventService.InsertCustomerEvent(model.AddedEventUserId, tmpCustomer.Id, model.AddedAcceptedStatus, model.AddedAcceptedImageUse); //Close popup and refresh list ViewBag.RefreshPage = true; ViewBag.btnId = btnId; ViewBag.formId = formId; return(View("~/Plugins/Cameleo.CameleoEvents/Views/Admin/CustomerEvent/AddCustomerEventPopup.cshtml", model)); } //If we got this far, something failed, redisplay form return(View("~/Plugins/Cameleo.CameleoEvents/Views/Admin/CustomerEvent/AddCustomerEventPopup.cshtml", model)); }
public ActionResult AddAllCustomerEventsPopup(int eventId, string groupName) { var model = new AddCustomerEventViewModel(); //Event model.CameleoEvent = _eventService.GetEventViewModel(eventId); ////Get event users for this group //model.CameleoEventUserList = _eventUserService.GetEventUserListViewModel(eventId, groupName); ////Get customer events for this group //model.CameleoCustomerEventList = _customerEventService.GetCustomerEventListViewModel(eventId, groupName); //Group name model.GroupName = groupName; return(View("~/Plugins/Cameleo.CameleoEvents/Views/Admin/CustomerEvent/AddAllCustomerEventsPopup.cshtml", model)); }