Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProductName,ProductCatalog,ProductModel,ProductParameter,ProductDesc")] Product product)
        {
            if (id != product.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.ProductCatalog = new SelectList(System.Enum.GetValues(typeof(ProductCatalog)), product.ProductCatalog);
            return(View(product));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProjectName,ProjectType,Province,Region,StartDate,DeliveryDate,Status")] Project project)
        {
            if (id != project.ID)
            {
                return(NotFound());
            }



            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            EnumDropDownList(null, project.Region, project.Province, null, project.ProjectType, project.Status, null, null, null, null);
            return(View(project));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,PartyID,ContactName,Title,Tel,Email")] Contact contact)
        {
            if (id != contact.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contact);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactExists(contact.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["PartyID"] = new SelectList(_context.Parties, "ID", "PartyName", contact.PartyID);
            return(View(contact));
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,EmpName,Dept,Title")] Employee employee)
        {
            if (id != employee.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(employee));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PartyName,PartyType")] Party party)
        {
            if (id != party.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(party);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartyExists(party.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.PartyType = new SelectList(System.Enum.GetValues(typeof(PartyType)), party.PartyType);
            return(View(party));
        }
Exemple #6
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ContractName,SignDate,Amount")] Contract contract)
        {
            if (id != contract.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contract);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractExists(contract.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(contract));
        }