コード例 #1
0
        public async Task <IActionResult> Details(int id)
        {
            Firm item = await FirmRepo.Find(id);

            if (item == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(item));
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            Firm firm = await FirmRepo.Find(id);

            if (firm == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(firm));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id)
        {
            Firm model = await FirmRepo.Find(id);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
コード例 #4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            Firm firm = await FirmRepo.Find(id);

            if (firm == null)
            {
                return(RedirectToAction("Index"));
            }

            await FirmRepo.Remove(id);

            return(RedirectToAction("Index"));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, Firm item)
        {
            Firm firm = await FirmRepo.Find(id);

            if (firm != null && ModelState.IsValid)
            {
                await FirmRepo.Update(item);

                return(RedirectToAction("Details", new { id = firm.Id }));
            }

            return(View(firm));
        }
コード例 #6
0
        public async Task <IActionResult> Employees(int id)
        {
            List <Employee> employeeList = await EmployeeRepo.GetFirmEmployees(id);

            Firm firm = await FirmRepo.Find(id);

            FirmEmployeesViewModel firmEmployeesViewModel = new FirmEmployeesViewModel()
            {
                Employees = employeeList,
                PageTitle = firm.Name + "'s Employees",
                Id        = firm.Id
            };

            return(View(firmEmployeesViewModel));
        }