Exemple #1
0
        public async Task <IActionResult> Create([Bind("ID,EmpName,Dept,Title")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(employee));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ID,ContractName,SignDate,Amount")] Contract contract)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contract);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(contract));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("ID,ProductName,ProductCatalog,ProductModel,ProductParameter,ProductDesc")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.ProductCatalog = new SelectList(System.Enum.GetValues(typeof(ProductCatalog)), product.ProductCatalog);
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("ID,PartyID,ContactName,Title,Tel,Email")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contact);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["PartyID"] = new SelectList(_context.Parties, "ID", "PartyName", contact.PartyID);
            return(View(contact));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("ID,PartyName,PartyType")] Party party)
        {
            if (ModelState.IsValid)
            {
                _context.Add(party);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.PartyType = new SelectList(System.Enum.GetValues(typeof(PartyType)), party.PartyType);
            return(View(party));
        }
Exemple #6
0
        public async Task <IActionResult> Create([Bind("ID,ProjectName,ProjectType,Province,Region,StartDate,DeliveryDate,Status")] Project project)
        {
            if (ModelState.IsValid)
            {
                _context.Add(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            EnumDropDownList(null, project.Region, project.Province, null, project.ProjectType, project.Status, null, null, null, null);
            return(View(project));
        }