예제 #1
0
        public async Task <ActionResult> DeleteStep(int stepId, LogChecklistSteps step)
        {
            _repo.Delete(step);
            var checklist = await _repo.GetChecklist(step.Idchecklist, step.Version);

            var stepNum = 1;
            var steps   = checklist.LogChecklistSteps.OrderByDescending(s => s.Step);

            foreach (var s in steps)
            {
                s.Step = (short)stepNum;
                stepNum++;
            }
            _repo.Add(FileHistory(step, "Draft", "Deleted a Step"));

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }
            return(BadRequest("There was a problem deleting this step. Please try again"));
        }
        public async Task <ActionResult <LogChecklist> > GetbyId([FromRoute] int id, short ver)
        {
            var checklist = await _repo.GetChecklist(id, ver);

            return(checklist);
        }