public async Task <IActionResult> ConditionCustomerGroupInsert(CustomerReminderModel.ConditionModel.AddCustomerGroupConditionModel model) { if (ModelState.IsValid) { await _customerReminderViewModelService.InsertCustomerGroupConditionModel(model); return(new JsonResult("")); } return(ErrorForKendoGridJson(ModelState)); }
public virtual async Task InsertCustomerGroupConditionModel(CustomerReminderModel.ConditionModel.AddCustomerGroupConditionModel model) { var customerReminder = await _customerReminderService.GetCustomerReminderById(model.CustomerReminderId); if (customerReminder != null) { var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId); if (condition != null) { if (condition.CustomerGroups.Where(x => x == model.CustomerGroupId).Count() == 0) { condition.CustomerGroups.Add(model.CustomerGroupId); await _customerReminderService.UpdateCustomerReminder(customerReminder); } } } }