Beispiel #1
0
        public async Task <ActionResult> AddStep(LogChecklistSteps step)
        {
            //get count
            var stepCount = _repo.GetStepCount(step);

            step.Step = (short)stepCount;

            _repo.Add(step);
            var history = FileHistory(step, "Draft", "Added a Step");


            _repo.Add(history);

            await _repo.SaveAll();

            return(CreatedAtRoute("GetStep", new { stepId = step.Idstep }, step));
        }
        public async Task <ActionResult> CreateChecklist([FromBody] LogChecklist checklist)
        {
            checklist.Version = 1;
            checklist.Status  = "Draft";

            var index = new LogChecklistIndex()
            {
                CreatedBy   = user,
                CreatedTime = DateTime.Now,
            };

            _repo.Add(index);
            checklist.Idchecklist = index.Idchecklist;
            _repo.Add(checklist);

            var history = LogHistory(checklist, "Create new Checklist Version", 1);

            _repo.Add(history);


            if (await _repo.SaveAll())
            {
                return(CreatedAtAction("GetbyId", new { id = checklist.Idchecklist, ver = checklist.Version }, checklist));
            }

            return(BadRequest("Failed to Create Checklist"));
        }