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

            if (id != mayraCabreraFriend.FriendId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MayraCabreraFriend mayraCabreraFriend = db.MayraCabreraFriends.Find(id);

            db.MayraCabreraFriends.Remove(mayraCabreraFriend);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "FriendId,Name,DateType,Apodo,TipoAmigo")] MayraCabreraFriend mayraCabreraFriend)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mayraCabreraFriend).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mayraCabreraFriend));
 }
コード例 #4
0
        public ActionResult Create([Bind(Include = "FriendId,Name,DateType,Apodo,TipoAmigo")] MayraCabreraFriend mayraCabreraFriend)
        {
            if (ModelState.IsValid)
            {
                db.MayraCabreraFriends.Add(mayraCabreraFriend);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mayraCabreraFriend));
        }
コード例 #5
0
        public IHttpActionResult GetMayraCabreraFriend(int id)
        {
            MayraCabreraFriend mayraCabreraFriend = db.MayraCabreraFriends.Find(id);

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

            return(Ok(mayraCabreraFriend));
        }
コード例 #6
0
        public IHttpActionResult PostMayraCabreraFriend(MayraCabreraFriend mayraCabreraFriend)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MayraCabreraFriends.Add(mayraCabreraFriend);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = mayraCabreraFriend.FriendId }, mayraCabreraFriend));
        }
コード例 #7
0
        // GET: MayraCabreraFriends/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MayraCabreraFriend mayraCabreraFriend = db.MayraCabreraFriends.Find(id);

            if (mayraCabreraFriend == null)
            {
                return(HttpNotFound());
            }
            return(View(mayraCabreraFriend));
        }
コード例 #8
0
        public IHttpActionResult DeleteMayraCabreraFriend(int id)
        {
            MayraCabreraFriend mayraCabreraFriend = db.MayraCabreraFriends.Find(id);

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

            db.MayraCabreraFriends.Remove(mayraCabreraFriend);
            db.SaveChanges();

            return(Ok(mayraCabreraFriend));
        }