コード例 #1
0
        public ITestActionResult Post([FromBody] DateAndTimeOfDayModel dt)
        {
            Assert.NotNull(dt);

            Assert.Equal(99, dt.Id);
            Assert.Equal(new DateTime(2099, 1, 1), dt.Birthday);
            Assert.Equal(new TimeSpan(0, 14, 13, 15, 179), dt.CreatedTime);
            Assert.Equal(new DateTime(1990, 12, 22), dt.EndDay);

            return(Created(dt));
        }
コード例 #2
0
        public ITestActionResult Get(int key)
        {
            DateAndTimeOfDayModel dtm = db.DateTimes.FirstOrDefault(e => e.Id == key);

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

            return(Ok(dtm));
        }