コード例 #1
0
        public IActionResult ReplaceLines(string id, string lineId, [FromBody] TimecardLine timecardLine)
        {
            Timecard timecard = Database.Find(id);

            if (timecard != null)
            {
                if (timecard.Status != TimecardStatus.Draft)
                {
                    return(StatusCode(409, new InvalidStateError()
                    {
                    }));
                }

                var annotatedLine = timecard.GetLine(new Guid(lineId));

                if (annotatedLine != null)
                {
                    annotatedLine.ReplaceLineInfo(timecardLine);
                    return(Ok(annotatedLine));
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(NotFound());
            }
        }