コード例 #1
0
        public IHttpActionResult PutEmoPicture(int id, EmoPicture emoPicture)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(emoPicture).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmoPictureExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "Id,Name,Path")] EmoPicture emoPicture)
        {
            if (ModelState.IsValid)
            {
                db.EmoPictures.Add(emoPicture);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(emoPicture));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Score,EmoFaceId,EmotionType")] EmoEmotion emoEmotion)
        {
            if (ModelState.IsValid)
            {
                db.EmoEmotion.Add(emoEmotion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmoFaceId = new SelectList(db.EmoFaces, "Id", "Id", emoEmotion.EmoFaceId);
            return(View(emoEmotion));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "Id,EmoPictureId,X,Y,Width,Height")] EmoFace emoFace)
        {
            if (ModelState.IsValid)
            {
                db.EmoFaces.Add(emoFace);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmoPictureId = new SelectList(db.EmoPictures, "Id", "Name", emoFace.EmoPictureId);
            return(View(emoFace));
        }