Ejemplo n.º 1
0
        public async Task <IActionResult> PutBar([FromRoute] int id, [FromBody] Bar bar)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> PutOrder(int id, Order order)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
 public ActionResult EdytujKlienta([Bind(Include = "Id,Imie,Nazwisko,Telefon,Email")] Klient klient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(klient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Szczegoly", new { id = klient.Id }));
     }
     return(View(klient));
 }