Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,InvoiceDate,Address,EmployeeId,UserId,Total")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(invoice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(invoice));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("UserId,Email,Password,FullName,Gender,Dob,Phonenumber,Address,Image")] StoreUser storeUser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(storeUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(storeUser));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("ProductId,CategoryId,ProductCategory,ProductName,Image,Description,SalePrice,TimesBooked,Quantity")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id_Invoice,ProductId,Quantity")] InvoiceDetail invoiceDetail)
        {
            if (ModelState.IsValid)
            {
                _context.Add(invoiceDetail);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(invoiceDetail));
        }
        public async Task <IActionResult> Create([Bind("ProductCategory_ID,PD_Name,PD_Description")] ProductCategory productCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productCategory));
        }
Пример #6
0
        public async Task <IActionResult> AddOrEditEmployee([Bind("EmployeeId,EmpCode,Position,OfficeLocation,HireDate,BaseSalary")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                if (employee.EmployeeId == 0)
                {
                    _context.Add(employee);
                }
                else
                {
                    _context.Update(employee);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }