コード例 #1
0
        public IHttpActionResult CreateData(Entry entry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model data is invalid"));
            }

            _context.Entries.Add(entry);
            _context.SaveChanges();
            return(Ok(entry));
        }
        public IHttpActionResult CreateData(Comment comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model data is invalid"));
            }

            _context.Comments.Add(comment);
            _context.SaveChanges();
            return(Ok(comment));
        }