Egyéb
This commit is contained in:
@@ -23,7 +23,7 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
{
|
{
|
||||||
IsSuccess = true,
|
IsSuccess = true,
|
||||||
};
|
};
|
||||||
var checkListHeaderDTO = await _checkListService.GetCheckListHeader(id );
|
var checkListHeaderDTO = await _checkListService.GetCheckListHeaderAsync(id );
|
||||||
|
|
||||||
if (checkListHeaderDTO != null)
|
if (checkListHeaderDTO != null)
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await _checkListService.StartNew(request);
|
var response = await _checkListService.StartNewCheckListAsync(request);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.BL.Services.Interfaces;
|
using WorkFlowCheck.BL.Services.Interfaces;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using WorkFlowCheck.BL.Services;
|
||||||
|
|
||||||
namespace WorkFlowCheck.API.Controllers
|
namespace WorkFlowCheck.API.Controllers
|
||||||
{
|
{
|
||||||
@@ -16,9 +17,9 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
{
|
{
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("GetUser/{id}")]
|
||||||
public async Task<ApiResponseDTO<UserDTO>> Get(int id)
|
public async Task<ApiResponseDTO<UserDTO>> GetUser(int id)
|
||||||
{
|
{
|
||||||
var retVal = new ApiResponseDTO<UserDTO>()
|
var retVal = new ApiResponseDTO<UserDTO>()
|
||||||
{
|
{
|
||||||
@@ -48,7 +49,6 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("GetAllUser")]
|
[HttpGet("GetAllUser")]
|
||||||
public async Task<ApiResponseDTO<List<UserDTO>>> GetAllUser()
|
public async Task<ApiResponseDTO<List<UserDTO>>> GetAllUser()
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,27 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
[HttpPost("UpdateUser")]
|
||||||
|
public async Task<ApiResponseDTO<UserDTO>> UpdateUser([FromBody] UserDTO UserDTO)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<UserDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _userService.UpdateUserAsync(UserDTO);
|
||||||
|
retVal.Data = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
[HttpPost("Authenticate")]
|
[HttpPost("Authenticate")]
|
||||||
public async Task<ApiResponseDTO<UserDTO>> Authenticate([FromBody] UserDTO userDTO)
|
public async Task<ApiResponseDTO<UserDTO>> Authenticate([FromBody] UserDTO userDTO)
|
||||||
{
|
{
|
||||||
@@ -119,5 +139,82 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetRole/{id}")]
|
||||||
|
public async Task<ApiResponseDTO<RoleDTO>> GetRole(int id)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<RoleDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
var RoleDTO = await _userService.GetRoleAsync(id);
|
||||||
|
|
||||||
|
if (RoleDTO != null)
|
||||||
|
{
|
||||||
|
if (RoleDTO.Id == 0)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No match!");
|
||||||
|
retVal.Data = RoleDTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = RoleDTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
[HttpGet("GetAllRole")]
|
||||||
|
public async Task<ApiResponseDTO<List<RoleDTO>>> GetAllRole()
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<List<RoleDTO>>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
var RoleDTO = await _userService.GetAllRoleAsync();
|
||||||
|
|
||||||
|
if (RoleDTO != null)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = RoleDTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
[HttpPost("UpdateRole")]
|
||||||
|
public async Task<ApiResponseDTO<RoleDTO>> UpdateRole([FromBody] RoleDTO RoleDTO)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<RoleDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _userService.UpdateRoleAsync(RoleDTO);
|
||||||
|
retVal.Data = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
}
|
}
|
||||||
public async Task<CheckListHeaderDTO> GetCheckListHeader(int Id)
|
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id)
|
||||||
{
|
{
|
||||||
var retVal = new CheckListHeaderDTO()
|
var retVal = new CheckListHeaderDTO()
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
public async Task<CheckListHeaderDTO> StartNew(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
||||||
{
|
{
|
||||||
var retVal = new CheckListHeaderDTO()
|
var retVal = new CheckListHeaderDTO()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
|||||||
{
|
{
|
||||||
public interface ICheckListService
|
public interface ICheckListService
|
||||||
{
|
{
|
||||||
Task<CheckListHeaderDTO> GetCheckListHeader(int Id);
|
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
|
||||||
Task<CheckListHeaderDTO> StartNew(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
|
Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user