@@ -22,44 +22,44 @@ public SellersController(SellerService sellerService, DepartmentService departme
2222 _departmentService = departmentService ;
2323 }
2424
25- public IActionResult Index ( )
25+ public async Task < IActionResult > Index ( )
2626 {
27- var list = _sellerService . FindAll ( ) ;
27+ var list = await _sellerService . FindAllAsync ( ) ;
2828 return View ( list ) ;
2929 }
3030
31- public IActionResult Create ( )
31+ public async Task < IActionResult > Create ( )
3232 {
33- var departments = _departmentService . FindAll ( ) ;
33+ var departments = await _departmentService . FindAllAsync ( ) ;
3434 var viewModel = new SellerFormViewModel { Departments = departments } ;
3535 return View ( viewModel ) ;
3636 }
3737
3838
3939 [ HttpPost ]
4040 [ ValidateAntiForgeryToken ]
41- public IActionResult Create ( Seller seller )
41+ public async Task < IActionResult > Create ( Seller seller )
4242 {
4343 if ( ! ModelState . IsValid )
4444 {
45- var departments = _departmentService . FindAll ( ) ;
45+ var departments = await _departmentService . FindAllAsync ( ) ;
4646 var viewModel = new SellerFormViewModel { Seller = seller , Departments = departments } ;
4747 return View ( seller ) ;
4848 }
4949
5050
51- _sellerService . Insert ( seller ) ;
51+ await _sellerService . InsertAsync ( seller ) ;
5252 return RedirectToAction ( nameof ( Index ) ) ;
5353 }
5454
55- public IActionResult Delete ( int ? id )
55+ public async Task < IActionResult > Delete ( int ? id )
5656 {
5757 if ( id == null )
5858 {
5959 return RedirectToAction ( nameof ( Error ) , new { message = "Id not provided" } ) ;
6060 }
6161
62- var obj = _sellerService . FindById ( id . Value ) ;
62+ var obj = await _sellerService . FindByIdAsync ( id . Value ) ;
6363 if ( obj == null )
6464 {
6565 return RedirectToAction ( nameof ( Error ) , new { message = "Id not found" } ) ;
@@ -70,52 +70,52 @@ public IActionResult Delete(int? id)
7070
7171 [ HttpPost ]
7272 [ AutoValidateAntiforgeryToken ]
73- public IActionResult Delete ( int id )
73+ public async Task < IActionResult > Delete ( int id )
7474 {
75- _sellerService . Remove ( id ) ;
75+ await _sellerService . RemoveAsync ( id ) ;
7676 return RedirectToAction ( nameof ( Index ) ) ;
7777 }
7878
79- public IActionResult Details ( int ? id )
79+ public async Task < IActionResult > Details ( int ? id )
8080 {
8181 if ( id == null )
8282 {
8383 return RedirectToAction ( nameof ( Error ) , new { message = "Id not provided" } ) ;
8484 }
8585
86- var obj = _sellerService . FindById ( id . Value ) ;
86+ var obj = await _sellerService . FindByIdAsync ( id . Value ) ;
8787 if ( obj == null )
8888 {
8989 return RedirectToAction ( nameof ( Error ) , new { message = "Id not found" } ) ;
9090 }
9191 return View ( obj ) ;
9292 }
9393
94- public IActionResult Edit ( int ? id )
94+ public async Task < IActionResult > Edit ( int ? id )
9595 {
9696 if ( id == null )
9797 {
9898 return RedirectToAction ( nameof ( Error ) , new { message = "Id not provided" } ) ;
9999 }
100100
101- var obj = _sellerService . FindById ( id . Value ) ;
101+ var obj = await _sellerService . FindByIdAsync ( id . Value ) ;
102102 if ( obj == null )
103103 {
104104 return RedirectToAction ( nameof ( Error ) , new { message = "Id not found" } ) ;
105105 }
106106
107- List < Department > departments = _departmentService . FindAll ( ) ;
107+ List < Department > departments = await _departmentService . FindAllAsync ( ) ;
108108 SellerFormViewModel viewModel = new SellerFormViewModel { Seller = obj , Departments = departments } ;
109109 return View ( viewModel ) ;
110110 }
111111
112112 [ HttpPost ]
113113 [ ValidateAntiForgeryToken ]
114- public IActionResult Edit ( int id , Seller seller )
114+ public async Task < IActionResult > Edit ( int id , Seller seller )
115115 {
116116 if ( ! ModelState . IsValid )
117117 {
118- var departments = _departmentService . FindAll ( ) ;
118+ var departments = await _departmentService . FindAllAsync ( ) ;
119119 var viewModel = new SellerFormViewModel { Seller = seller , Departments = departments } ;
120120 return View ( seller ) ;
121121 }
@@ -127,7 +127,7 @@ public IActionResult Edit(int id, Seller seller)
127127
128128 try
129129 {
130- _sellerService . Update ( seller ) ;
130+ await _sellerService . UpdateAsync ( seller ) ;
131131 return RedirectToAction ( nameof ( Index ) ) ;
132132 }
133133 catch ( NotFoundException e )
0 commit comments