public virtual async Task <CustomerReminder.ReminderCondition> InsertConditionModel(CustomerReminder customerReminder, CustomerReminderModel.ConditionModel model)
        {
            var condition = new CustomerReminder.ReminderCondition()
            {
                Name            = model.Name,
                ConditionTypeId = model.ConditionTypeId,
                ConditionId     = model.ConditionId,
            };

            customerReminder.Conditions.Add(condition);
            await _customerReminderService.UpdateCustomerReminder(customerReminder);

            await _customerActivityService.InsertActivity("AddNewCustomerReminderCondition", customerReminder.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerReminder"), customerReminder.Name);

            return(condition);
        }
        public virtual async Task <CustomerReminder.ReminderCondition> UpdateConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition, CustomerReminderModel.ConditionModel model)
        {
            condition = model.ToEntity(condition);
            await _customerReminderService.UpdateCustomerReminder(customerReminder);

            await _customerActivityService.InsertActivity("EditCustomerReminderCondition", customerReminder.Id, _localizationService.GetResource("ActivityLog.EditCustomerReminderCondition"), customerReminder.Name);

            return(condition);
        }
        public virtual CustomerReminderModel.ConditionModel PrepareConditionModel(CustomerReminder customerReminder, CustomerReminder.ReminderCondition condition)
        {
            var model = condition.ToModel();

            model.CustomerReminderId = customerReminder.Id;
            foreach (CustomerReminderConditionTypeEnum item in Enum.GetValues(typeof(CustomerReminderConditionTypeEnum)))
            {
                model.ConditionType.Add(new SelectListItem()
                {
                    Value = ((int)item).ToString(),
                    Text  = item.ToString()
                });
            }
            return(model);
        }
Exemplo n.º 4
0
 public static CustomerReminder.ReminderCondition ToEntity(this CustomerReminderModel.ConditionModel model, CustomerReminder.ReminderCondition destination)
 {
     return(model.MapTo(destination));
 }
Exemplo n.º 5
0
 public static CustomerReminderModel.ConditionModel ToModel(this CustomerReminder.ReminderCondition entity)
 {
     return(entity.MapTo <CustomerReminder.ReminderCondition, CustomerReminderModel.ConditionModel>());
 }