public IActionResult ManufacturerAddPopup(string customerReminderId, string conditionId) { var model = new CustomerReminderModel.ConditionModel.AddManufacturerConditionModel(); model.ConditionId = conditionId; model.CustomerReminderId = customerReminderId; return(View(model)); }
public async Task <IActionResult> ManufacturerAddPopup(CustomerReminderModel.ConditionModel.AddManufacturerConditionModel model) { if (model.SelectedManufacturerIds != null) { await _customerReminderViewModelService.InsertManufacturerConditionModel(model); } ViewBag.RefreshPage = true; return(View(model)); }
public IActionResult ManufacturerAddPopupList(DataSourceRequest command, CustomerReminderModel.ConditionModel.AddManufacturerConditionModel model) { var manufacturers = _manufacturerService.GetAllManufacturers(model.SearchManufacturerName, "", command.Page - 1, command.PageSize, true); var gridModel = new DataSourceResult { Data = manufacturers.Select(x => x.ToModel()), Total = manufacturers.TotalCount }; return(Json(gridModel)); }
public virtual void InsertManufacturerConditionModel(CustomerReminderModel.ConditionModel.AddManufacturerConditionModel model) { foreach (string id in model.SelectedManufacturerIds) { var customerReminder = _customerReminderService.GetCustomerReminderById(model.CustomerReminderId); if (customerReminder != null) { var condition = customerReminder.Conditions.FirstOrDefault(x => x.Id == model.ConditionId); if (condition != null) { if (condition.Manufacturers.Where(x => x == id).Count() == 0) { condition.Manufacturers.Add(id); _customerReminderService.UpdateCustomerReminder(customerReminder); } } } } }