コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Type")] Member member)
 {
     if (ModelState.IsValid)
     {
         db.Entry(member).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
コード例 #2
0
        public IHttpActionResult PutProduct(int id, Product product)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult PutUserLogin(int id, UserLogin userLogin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userLogin.UserLoginID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,Title,Rating")] Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(game));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "Id,City,MemberId")] Address address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MemberId = new SelectList(db.Members, "Id", "FirstName", address.MemberId);
     return(View(address));
 }
コード例 #6
0
        public async Task <ActionResult> Edit([Bind(Include = "UserId,UserName,Password,Email,FirstName,LastName,Address,City,State,ZipCode")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
コード例 #7
0
        public ActionResult Edit([Bind(Include = "Id,PoolsId,path,filename,displayname,width,heigth,hsv")] Images images)
        {
            if (ModelState.IsValid)
            {
                db.Entry(images).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Details", "Pools", new { id = images.PoolsId }));
            }

            ViewBag.PoolsId = new SelectList(db.PoolsSet, "Id", "name", images.PoolsId);
            return(View(images));
        }
コード例 #8
0
        public ActionResult Edit([Bind(Include = "Id,owner,name,size,writelock")] Pools pools)
        {
            if (pools.owner != User.Identity.Name)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                db.Entry(pools).State = EntityState.Modified;
                db.SaveChanges();
                if (pools.size == 0)
                {
                    return(RedirectToAction("Bildersammlungen"));
                }
                return(RedirectToAction("Kacheln"));
            }
            return(View(pools));
        }