Ejemplo n.º 1
0
 protected override NgResult _delete(MessageScheduleVM[] models)
 {
     using (var l = new MessagesModuleLogic()) {
         foreach (var model in models)
         {
             l.Delete <tblMessageSchedule>(model.Id);
         }
     }
     return(NgResult.Succes(DEBS.Translate("MessageMdl.{0} schedules was removed", models.Count())));
 }
 protected override NgResult _delete(EmailSenderDataProviderVM[] models)
 {
     using (var l = new MessagesModuleLogic()) {
         foreach (var model in models)
         {
             l.Delete <tblEmailSenderDataProvider>(model.Id);
         }
     }
     return(NgResult.Succes(DEBS.Translate("MessageMdl.{0} email providers was removed", models.Count())));
 }
 protected void ManagerRFilterPart <TEnitity, TNgViewModel> (MessagesModuleLogic l, IEnumerable <TNgViewModel> items, Action <TEnitity, TNgViewModel> updater)
     where TEnitity : class, IMessagesModuleEntity
     where TNgViewModel : class, INgViewModel
 {
     if (items == null)
     {
         return;
     }
     //TODO OPTIMIZE work with DB
     foreach (var item in items)
     {
         TEnitity ent = null;
         if (item.ng_ToDelete)
         {
             l.Delete <TEnitity>(item.Id);
         }
         else if (item.ng_JustCreated)
         {
             ent = l.Create <TEnitity>();
         }
         else
         {
             ent = l.Get <TEnitity>(item.Id);
         }
         if (ent != null)
         {
             updater(ent, item);
             if (item.ng_JustCreated)
             {
                 l.Add(ent);
             }
             else
             {
                 l.SaveChanges(ent);
             }
         }
     }
 }