public ActionResult Process(AddToOrgFromTag model)
        {
            var op = new AddToOrgFromTag(model.QueryId, CurrentDatabase);

            op.Tag       = model.Tag;
            op.Count     = model.Count;
            op.Started   = model.Started;
            op.Completed = model.Completed;

            op.Validate(ModelState);

            if (!ModelState.IsValid) // show validation errors
            {
                return(View("Index", op));
            }

            op.UpdateLongRunningOp(CurrentDatabase, AddToOrgFromTag.Op);
            if (op.ShowCount(CurrentDatabase))
            {
                return(View("Index", op)); // let them confirm by seeing the count and the tagname
            }

            if (!op.Started.HasValue)
            {
                DbUtil.LogActivity($"Add to org from tag for {Session["ActiveOrganization"]}");
                op.Process(CurrentDatabase);
            }

            return(View(op));
        }
示例#2
0
        public ActionResult Process(AddToOrgFromTag model)
        {
            model.Validate(ModelState);

            if (!ModelState.IsValid) // show validation errors
            {
                return(View("Index", model));
            }

            model.UpdateLongRunningOp(DbUtil.Db, AddToOrgFromTag.Op);
            if (model.ShowCount(DbUtil.Db))
            {
                return(View("Index", model)); // let them confirm by seeing the count and the tagname
            }
            if (!model.Started.HasValue)
            {
                DbUtil.LogActivity($"Add to org from tag for {Session["ActiveOrganization"]}");
                model.Process(DbUtil.Db);
            }

            return(View(model));
        }