예제 #1
0
        public IActionResult Patch([FromODataUri] int key, [FromBody] Delta <SprintStagesHistory> patch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            SprintStagesHistory history = _history.GetById(key);

            if (history == null)
            {
                return(NotFound());
            }

            patch.Patch(history);

            try
            {
                _history.Save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (_history.GetById(key) == null)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(history));
        }
예제 #2
0
        public IActionResult Post([FromBody] SprintStagesHistory createSprint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _history.Create(createSprint);

            _history.Save();

            return(Created(createSprint));
        }
예제 #3
0
        public static void FillSprintStagesData()
        {
            _dbHisories = new Repository <SprintStagesHistory>(_context);

            SprintStagesHistory[] sprintStagesHistories = new SprintStagesHistory[]
            {
                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 06, 01),
                    Ended   = new DateTime(2018, 06, 15)
                },

                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 06, 16),
                    Ended   = new DateTime(2018, 06, 30)
                },

                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 07, 01),
                    Ended   = new DateTime(2018, 07, 13)
                },

                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 07, 14),
                    Ended   = new DateTime(2018, 07, 28)
                },

                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 07, 29),
                    Ended   = new DateTime(2018, 08, 17)
                },

                new SprintStagesHistory()
                {
                    Begined = new DateTime(2018, 08, 18),
                    Ended   = new DateTime(2018, 08, 30)
                },
            };

            AddToDatabase(sprintStagesHistories, _dbHisories);
        }