示例#1
0
        public async Task <IActionResult> PutProduct([FromRoute] Guid id, [FromBody] Product product)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <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
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
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));
        }
        public async Task <IActionResult> PutEdmin([FromRoute] int id, [FromBody] Edmin edmin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != edmin.edminId)
            {
                return(BadRequest());
            }

            _context.Entry(edmin).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EdminExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit(CreateSamouraiView CEditS)
 {
     if (ModelState.IsValid)
     {
         Samourai samourai = db.Samourais.Find(CEditS.Samourai.Id);
         samourai.Nom   = CEditS.Samourai.Nom;
         samourai.Force = CEditS.Samourai.Force;
         if (CEditS.IdArtsMartiaux.Count > 0)
         {
             samourai.ArtMartials = db.ArtMartials.Where(x => CEditS.IdArtsMartiaux.Contains(x.Id)).ToList();
         }
         else
         {
             samourai.ArtMartials = null;
         }
         if (CEditS.IdArmes != null)
         {
             Arme arme = db.Armes.FirstOrDefault(i => i.Id == CEditS.IdArmes);
             samourai.Arme      = arme;
             samourai.Potentiel = (samourai.Force + samourai.Arme.Degats) * (samourai.ArtMartials.Count + 1);
         }
         else
         {
             samourai.Arme = null;
         }
         db.Entry(samourai).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(CEditS));
 }
 public ActionResult Edit([Bind(Include = "CommentsID,Comment")] Comments comments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(comments));
 }
示例#7
0
 public ActionResult Edit([Bind(Include = "id,UserID,LOOKRoleID,RoleName,IsRoleActive,LoginName,Password,FirstName,LastName,Gender")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
 public ActionResult Edit([Bind(Include = "id,Cost,Year,Make,Model,color")] Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(car));
 }
 public ActionResult Edit([Bind(Include = "id,Value,LotSize,Address,City,State,PostalCode")] House house)
 {
     if (ModelState.IsValid)
     {
         db.Entry(house).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(house));
 }
 public ActionResult Edit([Bind(Include = "ID,Name")] Book book)
 {
     if (ModelState.IsValid)
     {
         db.Entry(book).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(book));
 }
 public ActionResult Edit([Bind(Include = "CategoryID,Title,Description")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
示例#12
0
 public ActionResult Edit([Bind(Include = "id,Name,admin")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Path")] EmoPicture emoPicture)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emoPicture).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(emoPicture));
 }
示例#14
0
 public ActionResult Edit([Bind(Include = "id,name,x,y")] Markers markers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(markers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(markers));
 }
示例#15
0
 public ActionResult Edit([Bind(Include = "Id,x,y,address,title")] Orange orange)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orange).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(orange));
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "Id,Nom")] ArtMartial artMartial)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artMartial).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(artMartial));
 }
 public ActionResult Edit([Bind(Include = "Id,EmoPictureId,X,Y,Width,Height")] EmoFace emoFace)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emoFace).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmoPictureId = new SelectList(db.EmoPictures, "Id", "Name", emoFace.EmoPictureId);
     return(View(emoFace));
 }
示例#18
0
 public ActionResult Edit([Bind(Include = "ReviewID,Title,Author,Date,Content,CategoryID")] Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Title", review.CategoryID);
     return(View(review));
 }
示例#19
0
 public ActionResult Edit([Bind(Include = "Id,EmotionType,Score,EmoFaceId")] EmoEmotion emoEmotion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emoEmotion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmoFaceId = new SelectList(db.EmoFaces, "Id", "Id", emoEmotion.EmoFaceId);
     return(View(emoEmotion));
 }
示例#20
0
        public ActionResult Edit([Bind(Include = "Id,Id_Tipo_Documento,Numero_Documento,Nombre,Apellido,EStado")] ViewModelEmpleado viewModelEmpleado)
        {
            if (ModelState.IsValid)
            {
                db.Entry(viewModelEmpleado).State = EntityState.Modified;

                EmpleadoM  item = viewModelEmpleado.Castear();
                EmpleadoBL neg  = new EmpleadoBL();
                neg.Modificar(item);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(viewModelEmpleado));
        }