예제 #1
0
        public async Task <IActionResult> PutOrder(int id, Models.Order order)
        {
            if (id != order.OrderId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutProduct(int id, Models.Product product)
        {
            if (id != product.ProductId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult> Create([Bind(Include = "JobID,Name,EmployeeID")] Job job)
        {
            if (ModelState.IsValid)
            {
                db.Jobs.Add(job);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeID = new SelectList(db.Employees, "ID", "FirstName", job.EmployeeID);
            return(View(job));
        }