示例#1
0
        public IActionResult Edit(Script script)
        {
            script.Author       = User?.Identity?.Name;
            script.LastModified = DateTime.Now;

            if (script.Id == null)
            {
                _service.Create(script);
            }
            else
            {
                _service.Update(script);
            }

            return(Redirect("/script"));
        }
示例#2
0
        public async Task <IActionResult> CreateScript(ScriptDto script, CancellationToken cancellationToken)
        {
            var created = await _service.Create(script, HttpContext.GetCurrentUserId(), cancellationToken);

            return(Created(string.Empty, created));
        }