Skip to content

Commit cf5d028

Browse files
committed
updated
1 parent c7e0b53 commit cf5d028

15 files changed

Lines changed: 226 additions & 11 deletions

File tree

HRManagementSystem.Business/Interfaces/IAdvertisementAppUserService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ public interface IAdvertisementAppUserService
1313
{
1414
Task<IResponse<AdvertisementAppUserCreateDto>> CreateAsync(AdvertisementAppUserCreateDto dto);
1515
Task<List<AdvertisementAppUserListDto>> GetList(AdvertisementAppUserStatusType type);
16+
Task SetStatusAsync(int advertisementAppUserId, AdvertisementAppUserStatusType type);
1617
}
1718
}

HRManagementSystem.Business/Services/AdvertisementAppUserService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task<IResponse<AdvertisementAppUserCreateDto>> CreateAsync(Advertis
4040
{
4141
var createdAdvertisementAppUser = _mapper.Map<AdvertisementAppUser>(dto);
4242
await _unitOfWork.GetRepository<AdvertisementAppUser>().CreateAsync(createdAdvertisementAppUser);
43-
await _unitOfWork.SaveChanges();
43+
await _unitOfWork.SaveChangesAsync();
4444
return new Response<AdvertisementAppUserCreateDto>(ResponseType.Success, dto);
4545
}
4646

@@ -60,9 +60,17 @@ public async Task<IResponse<AdvertisementAppUserCreateDto>> CreateAsync(Advertis
6060
public async Task<List<AdvertisementAppUserListDto>> GetList(AdvertisementAppUserStatusType type)
6161
{
6262
var query = _unitOfWork.GetRepository<AdvertisementAppUser>().GetQuery();
63-
var list = await query.Include(x => x.Advertisement).Include(x => x.AdvertisementAppUserStatus).Include(x => x.MilitaryStatus).Include(x => x.AppUser).Where(x => x.AdvertisementAppUserStatusId == (int)type).ToListAsync();
63+
var list = await query.Include(x => x.Advertisement).Include(x => x.AdvertisementAppUserStatus).Include(x => x.MilitaryStatus).Include(x => x.AppUser).ThenInclude(x => x.Gender).Where(x => x.AdvertisementAppUserStatusId == (int)type).ToListAsync();
6464

6565
return _mapper.Map<List<AdvertisementAppUserListDto>>(list);
6666
}
67+
68+
public async Task SetStatusAsync(int advertisementAppUserId, AdvertisementAppUserStatusType type)
69+
{
70+
var query = _unitOfWork.GetRepository<AdvertisementAppUser>().GetQuery();
71+
var entity = await query.SingleOrDefaultAsync(x => x.Id == advertisementAppUserId);
72+
entity.AdvertisementAppUserStatusId = (int)type;
73+
await _unitOfWork.SaveChangesAsync();
74+
}
6775
}
6876
}

HRManagementSystem.Business/Services/AppUserService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ await _unitOfWork.GetRepository<AppUserRole>().CreateAsync(new AppUserRole
4343
AppUser = user,
4444
AppRoleId = roleId
4545
});
46-
await _unitOfWork.SaveChanges();
46+
await _unitOfWork.SaveChangesAsync();
4747

4848
return new Response<AppUserCreateDto>(ResponseType.Success, dto);
4949
}

HRManagementSystem.Business/Services/GenericService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task<IResponse<CreateDto>> CreateAsync(CreateDto dto)
4242
{
4343
var createdEntity = _mapper.Map<T>(dto);
4444
await _unitOfWork.GetRepository<T>().CreateAsync(createdEntity);
45-
await _unitOfWork.SaveChanges();
45+
await _unitOfWork.SaveChangesAsync();
4646
return new Response<CreateDto>(ResponseType.Success, dto);
4747
}
4848

@@ -75,7 +75,7 @@ public async Task<IResponse> RemoveAsync(int id)
7575
return new Response(ResponseType.NotFound, $"{id} idsine sahip data bulunamadı!");
7676
}
7777
_unitOfWork.GetRepository<T>().Remove(data);
78-
await _unitOfWork.SaveChanges();
78+
await _unitOfWork.SaveChangesAsync();
7979
return new Response(ResponseType.Success);
8080
}
8181

@@ -91,7 +91,7 @@ public async Task<IResponse<UpdateDto>> UpdateAsync(UpdateDto dto)
9191
}
9292
var entity = _mapper.Map<T>(dto);
9393
_unitOfWork.GetRepository<T>().Update(entity, unchangedData);
94-
await _unitOfWork.SaveChanges();
94+
await _unitOfWork.SaveChangesAsync();
9595
return new Response<UpdateDto>(ResponseType.Success, dto);
9696
}
9797

HRManagementSystem.DataAccess/UnitOfWork/IUnitOfWork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ namespace HRManagementSystem.DataAccess.UnitOfWork
1212
public interface IUnitOfWork
1313
{
1414
IRepository<T> GetRepository<T>() where T : BaseEntity;
15-
Task SaveChanges();
15+
Task SaveChangesAsync();
1616
}
1717
}

HRManagementSystem.DataAccess/UnitOfWork/UnitOfWork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public IRepository<T> GetRepository<T>() where T : BaseEntity
2424
return new Repository<T>(_context);
2525
}
2626

27-
public async Task SaveChanges()
27+
public async Task SaveChangesAsync()
2828
{
2929
await _context.SaveChangesAsync();
3030
}

HRManagementSystem.Dtos/AdvertisementAppUserDtos/AdvertisementAppUserListDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace HRManagementSystem.Dtos
88
{
99
public class AdvertisementAppUserListDto
1010
{
11+
public int Id { get; set; }
1112
public int AdvertisementId { get; set; }
1213
public AdvertisementListDto Advertisement { get; set; }
1314
public int AppUserId { get; set; }

HRManagementSystem.Dtos/AppUserDtos/AppUserListDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ public class AppUserListDto : IDto
1616
public string Password { get; set; }
1717
public string PhoneNumber { get; set; }
1818
public int GenderId { get; set; }
19+
public GenderListDto Gender { get; set; }
1920
}
2021
}

HRManagementSystem.UI/Controllers/AdvertisementController.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public async Task<IActionResult> Send(AdvertisementAppUserCreateModel model)
105105
return View(model);
106106
}
107107

108-
return RedirectToAction("HumanResource", "Home");
108+
return RedirectToAction("HumanResources", "Home");
109109
}
110110

111111
[Authorize(Roles = "Admin")]
@@ -114,5 +114,26 @@ public async Task<IActionResult> List()
114114
var list = await _advertisementAppUserService.GetList(AdvertisementAppUserStatusType.Applied);
115115
return View();
116116
}
117+
118+
[Authorize(Roles = "Admin")]
119+
public async Task<IActionResult> SetStatus(int advertisementAppUserId, AdvertisementAppUserStatusType type)
120+
{
121+
await _advertisementAppUserService.SetStatusAsync(advertisementAppUserId, type);
122+
return RedirectToAction("List");
123+
}
124+
125+
[Authorize(Roles = "Admin")]
126+
public async Task<IActionResult> ApprovedList()
127+
{
128+
var list = await _advertisementAppUserService.GetList(AdvertisementAppUserStatusType.Interview);
129+
return View();
130+
}
131+
132+
[Authorize(Roles = "Admin")]
133+
public async Task<IActionResult> RejectedList()
134+
{
135+
var list = await _advertisementAppUserService.GetList(AdvertisementAppUserStatusType.Negative);
136+
return View();
137+
}
117138
}
118139
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace HRManagementSystem.UI.Controllers
2+
{
3+
public class ApplicationController
4+
{
5+
}
6+
}

0 commit comments

Comments
 (0)