public static ArchivingAction FromTemplate(ArchivingActionTemplate template, IFilterService filterService, string item = null) { var targetArchive = template.DueDate.HasValue && template.DueDate.Value < DateTime.Now && template.OutputArchiveAfterDueDate != null ? template.OutputArchiveAfterDueDate : template.OutputArchive; return(new ArchivingAction { ActionType = template.ActionType, RelativeSourcePath = template.InputArchive.Path, FullLocalSourcePath = template.InputArchive.FullLocalPath, FullNetworkSourcePath = template.InputArchive.FullNetworkPath, SourceArchiveName = template.InputArchive.DisplayName, RelativeTargetPath = targetArchive.Path, FullLocalTargetPath = targetArchive.FullLocalPath, FullNetworkTargetPath = targetArchive.FullNetworkPath, TargetArchiveName = targetArchive.DisplayName, Item = item, RetryCount = template.RetryCount, RetryDelay = template.RetryDelay, Filter = !string.IsNullOrWhiteSpace(template.Filter) ? filterService.CreateFilter(template.Filter) : null, HandleSynchronously = template.HandleSynchronously, IncludeInternalItems = template.IncludeInternalItems }); }
public ActionResult CreateFilter(CreateFilterViewModel model) { if (ModelState.IsValid) { var game = _gameService.GetGameByValue(model.Game); var filter = Mapper.Map <CreateFilterViewModel, Model.Models.Filter>(model); filter.Game = game; _filterService.CreateFilter(filter); _filterService.SaveFilter(); return(RedirectToAction("FilterList")); } return(HttpNotFound()); }