コード例 #1
0
        public async Task <ActionResult> ChecklistAction(int updateId, int stepId, [FromQuery] string action)
        {
            var step = await _repo.GetUpdateSteps(stepId, updateId);

            var status = _repo.GetStatus(updateId);

            if (step == null)
            {
                BadRequest("Step does not exist");
            }
            switch (action)
            {
            case "complete":
                step.Progress = "Done";
                LogHistory(step, status, "Completed Step ");
                break;

            case "skip":
                step.Progress = "Skip";
                LogHistory(step, status, "Skipped Step ");
                break;

            case "clear":
                step.Progress = "";
                LogHistory(step, status, "Unchecked Step ");
                break;
            }
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }
            return(BadRequest("Error Saving, Please Try again"));
        }