Esempio n. 1
0
        // PUT api/Friend/5
        public IHttpActionResult PutFriend(int id, Friend friend)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != friend.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Phone,Email,City")] Friend friend)
 {
     if (ModelState.IsValid)
     {
         db.Entry(friend).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(friend));
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "indeks,id,ime,mestonaziveenje")] FriendModel friendModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(friendModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(friendModel));
 }
 public ActionResult Edit([Bind(Include = "ID,FriendID,Name,Hometown")] FriendModel friendModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(friendModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(friendModel));
 }