コード例 #1
0
 public virtual ActionResult Update(EditIndexViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return(RedirectToAction("Index", "Application"));
     }
     return(UpdateIndex(model));
 }
コード例 #2
0
ファイル: DeleteIndex.cs プロジェクト: aluetjen/ravendb
 public void Execute(EditIndexViewModel index)
 {
     showMessageBox(
         string.Format("Are you sure that you want to delete this index? ({0})", index.Name),
         "Confirm Deletion",
         MessageBoxOptions.OkCancel,
         box => {
         if (box.WasSelected(MessageBoxOptions.Ok))
         {
             ExecuteDeletion(index);
         }
     });
 }
コード例 #3
0
ファイル: DeleteIndex.cs プロジェクト: nhsevidence/ravendb
		public void Execute(EditIndexViewModel index)
		{
			showMessageBox(
				string.Format("Are you sure that you want to delete this index? ({0})", index.Name),
				"Confirm Deletion",
				MessageBoxOptions.OkCancel,
				box => {
					if (box.WasSelected(MessageBoxOptions.Ok))
					{
						ExecuteDeletion(index);
					}
				});
		}
コード例 #4
0
ファイル: DeleteIndex.cs プロジェクト: nhsevidence/ravendb
		void ExecuteDeletion(EditIndexViewModel index)
		{
			events.Publish(new WorkCompleted("removing index " + index.Name));
			using (var session = server.OpenSession())
			{
				session.Advanced.AsyncDatabaseCommands
					.DeleteIndexAsync(index.Name)
					.ContinueOnSuccess(task =>
										{
											events.Publish(new WorkCompleted("removing index " + index.Name));
											events.Publish(new IndexUpdated { Index = index, IsRemoved = true });
										});
			}
		}
コード例 #5
0
ファイル: DeleteIndex.cs プロジェクト: aluetjen/ravendb
 void ExecuteDeletion(EditIndexViewModel index)
 {
     events.Publish(new WorkCompleted("removing index " + index.Name));
     using (var session = server.OpenSession())
     {
         session.Advanced.AsyncDatabaseCommands
         .DeleteIndexAsync(index.Name)
         .ContinueOnSuccess(task =>
         {
             events.Publish(new WorkCompleted("removing index " + index.Name));
             events.Publish(new IndexUpdated {
                 Index = index, IsRemoved = true
             });
         });
     }
 }
コード例 #6
0
        public IActionResult TaskInfo(int taskId)
        {
            var asset = _dataContext.ReoccurringJob.FirstOrDefault(e => e.Id == taskId);

            var viewModel = new EditIndexViewModel

            {
                Id            = asset.Id,
                Name          = asset.Name,
                Url           = asset.Url,
                CronString    = asset.CronString,
                PriorityField = asset.PriorityField,
                Conditional   = asset.ConditionalExpression[0],
                Value         = asset.ConditionalExpression[1],
            };

            return(PartialView(viewModel));
        }
コード例 #7
0
        /**
         * GET /Page/EditIndex
         */
        public IActionResult EditIndex()
        {
            if (!sessMan.IsLoggedIn())
            {
                return(RedirectToAction("Main", "Page"));
            }
            EditIndexViewModel pageVM = new EditIndexViewModel {
                Pages       = PModel.GetMenu(),
                CurrentPage = new Page {
                    InternalName = "Edit",
                    DisplayName  = "Pagina bewerken - Index"
                },
                Dynamic   = false,
                EditPages = PModel.GetMenuInclContent()
            };

            return(View(pageVM));
        }
コード例 #8
0
        public async Task <IActionResult> EditConfirm(EditIndexViewModel model)
        {
            if (model.Value == null)
            {
                model.Value = "";
            }
            _dataContext.ReoccurringJob.Find(model.Id).Name                  = model.Name;
            _dataContext.ReoccurringJob.Find(model.Id).Url                   = model.Url;
            _dataContext.ReoccurringJob.Find(model.Id).CronString            = model.CronString;
            _dataContext.ReoccurringJob.Find(model.Id).PriorityField         = model.PriorityField;
            _dataContext.ReoccurringJob.Find(model.Id).ConditionalExpression = new string[] { model.Conditional.ToString(), model.Value.ToString() };
            _dataContext.ReoccurringJob.Find(model.Id).ContactGroup_Id       = model.ContactGroupId;
            _dataContext.CurrentJobResults.FirstOrDefault(e => e.ReoccurringJobId == model.Id).Name = model.Name;

            await _dataContext.SaveChangesAsync();

            await RunOnCommand(model.Id);

            return(RedirectToAction("Index"));
        }
コード例 #9
0
ファイル: DeleteIndex.cs プロジェクト: aluetjen/ravendb
 public bool CanExecute(EditIndexViewModel index)
 {
     return(index != null && string.IsNullOrWhiteSpace(index.Name) == false);
 }
コード例 #10
0
 private ActionResult UpdateIndex(EditIndexViewModel model)
 {
     _indexService.Update(model.IndexId, model.Name, model.ArchiveName, model.ArchiveColumn);
     return(RedirectToRoute(new { controller = "Application", action = "Index" }));
 }
コード例 #11
0
ファイル: DeleteIndex.cs プロジェクト: nhsevidence/ravendb
		public bool CanExecute(EditIndexViewModel index)
		{
			return index != null && string.IsNullOrWhiteSpace(index.Name) == false;
		}