コード例 #1
0
        public IHttpActionResult PostHoliday(HolidayViewModel holiday)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.UpdateHoliday(holiday.MapTo <Holiday>());

            return(Ok(holiday));
        }
コード例 #2
0
        public IHttpActionResult PutHoliday(int id, HolidayViewModel holiday)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != holiday.Id)
            {
                return(BadRequest());
            }

            db.UpdateHoliday(holiday.MapTo <Holiday>());

            return(StatusCode(HttpStatusCode.NoContent));
        }