@@ -22,13 +22,13 @@ public AdvertisementController(IAppUserService appUserService, IAdvertisementApp
2222
2323
2424 [ Authorize ( Roles = "Member" ) ]
25- [ HttpGet ]
2625 public async Task < IActionResult > Send ( int advertisementId )
2726 {
2827 var userId = int . Parse ( ( User . Claims . FirstOrDefault ( x => x . Type == ClaimTypes . NameIdentifier ) ) . Value ) ;
2928 var userResponse = await _appUserService . GetByIdAsync < AppUserListDto > ( userId ) ;
3029
3130 ViewBag . GenderId = userResponse . Data . GenderId ;
31+
3232 var items = Enum . GetValues ( typeof ( MilitaryStatusType ) ) ;
3333
3434 var list = new List < MilitaryStatusListDto > ( ) ;
@@ -38,18 +38,20 @@ public async Task<IActionResult> Send(int advertisementId)
3838 list . Add ( new MilitaryStatusListDto
3939 {
4040 Id = item ,
41- Definition = Enum . GetName ( typeof ( MilitaryStatusType ) , item )
41+ Definition = Enum . GetName ( typeof ( MilitaryStatusType ) , item ) ,
4242 } ) ;
4343 }
4444
4545 ViewBag . MilitaryStatus = new SelectList ( list , "Id" , "Definition" ) ;
46- return View ( new AdvertisementAppUserCreateModel ( )
46+
47+ return View ( new AdvertisementAppUserCreateModel
4748 {
4849 AdvertisementId = advertisementId ,
4950 AppUserId = userId ,
5051 } ) ;
5152 }
5253
54+
5355 [ Authorize ( Roles = "Member" ) ]
5456 [ HttpPost ]
5557 public async Task < IActionResult > Send ( AdvertisementAppUserCreateModel model )
@@ -73,7 +75,6 @@ public async Task<IActionResult> Send(AdvertisementAppUserCreateModel model)
7375 dto . WorkExperience = model . WorkExperience ;
7476
7577 var response = await _advertisementAppUserService . CreateAsync ( dto ) ;
76-
7778 if ( response . ResponseType == Common . Objects . ResponseType . ValidationError )
7879 {
7980 foreach ( var error in response . ValidationErrors )
@@ -95,23 +96,25 @@ public async Task<IActionResult> Send(AdvertisementAppUserCreateModel model)
9596 list . Add ( new MilitaryStatusListDto
9697 {
9798 Id = item ,
98- Definition = Enum . GetName ( typeof ( MilitaryStatusType ) , item )
99+ Definition = Enum . GetName ( typeof ( MilitaryStatusType ) , item ) ,
99100 } ) ;
100101 }
101102
102103 ViewBag . MilitaryStatus = new SelectList ( list , "Id" , "Definition" ) ;
103104
104105 return View ( model ) ;
105106 }
106-
107- return RedirectToAction ( "HumanResources" , "Home" ) ;
107+ else
108+ {
109+ return RedirectToAction ( "HumanResource" , "Home" ) ;
110+ }
108111 }
109112
110113 [ Authorize ( Roles = "Admin" ) ]
111114 public async Task < IActionResult > List ( )
112115 {
113116 var list = await _advertisementAppUserService . GetList ( AdvertisementAppUserStatusType . Applied ) ;
114- return View ( ) ;
117+ return View ( list ) ;
115118 }
116119
117120 [ Authorize ( Roles = "Admin" ) ]
0 commit comments