Ejemplo n.º 1
0
        public IHttpActionResult PutArticle(int id, Article article)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public async Task InsertOrUpdate(GAPPolicies policies)
 {
     using (var context = new GapContext())
     {
         context.Entry(policies).State = policies.EntityState.ToEntityFrameworkState();
         // context.Entry(policies.GAPCustomerPolicy).State = policies.GAPCustomerPolicy.EntityState.ToEntityFrameworkState();
         await context.SaveChangesAsync();
     }
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "id,name,address")] Store store)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(store));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "id,name,description,price,totalInShelf,totalInVault,storeId")] Article article)
 {
     if (ModelState.IsValid)
     {
         db.Entry(article).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(article));
 }