예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CargoWeight,CargoMaterial,WarehouseNo,CargoTag")] Cargocargo cargocargo)
        {
            if (id != cargocargo.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cargocargo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CargocargoExists(cargocargo.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(cargocargo));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,CargoWeight,CargoMaterial,WarehouseNo,CargoTag")] Cargocargo cargocargo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cargocargo);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(cargocargo));
        }