POST hogy tudjunk menteni is.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
using WorkFlowCheck.BL.Services;
|
using WorkFlowCheck.BL.Services;
|
||||||
using WorkFlowCheck.BL.Services.Interfaces;
|
using WorkFlowCheck.BL.Services.Interfaces;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
@@ -134,5 +135,27 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("authenticate")]
|
||||||
|
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint([FromBody] CheckPointDTO checkPointDTO)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<CheckPointDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _syncService.UpdateCheckPointAsync(checkPointDTO);
|
||||||
|
retVal.Data = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
|||||||
{
|
{
|
||||||
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
|
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
|
||||||
Task<CheckPointDTO> GetCheckPointAsync(int id);
|
Task<CheckPointDTO> GetCheckPointAsync(int id);
|
||||||
|
Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO);
|
||||||
Task<List<LocationDTO>> GetAllLocationAsync();
|
Task<List<LocationDTO>> GetAllLocationAsync();
|
||||||
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
|
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,30 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
public async Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO)
|
||||||
|
{
|
||||||
|
var retVal = new CheckPointDTO();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await _dbContext.CheckPoints.Where(w => w.Id == checkPointDTO.Id).FirstOrDefaultAsync();
|
||||||
|
if (res != null)
|
||||||
|
{
|
||||||
|
res.ShortName = checkPointDTO.ShortName;
|
||||||
|
res.Code = checkPointDTO.Code;
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
retVal = _mapper.Map<CheckPointDTO>(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
public async Task<List<LocationDTO>> GetAllLocationAsync()
|
public async Task<List<LocationDTO>> GetAllLocationAsync()
|
||||||
{
|
{
|
||||||
var retVal = new List<LocationDTO>();
|
var retVal = new List<LocationDTO>();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Serilog;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.Web.Services.Interfaces;
|
using WorkFlowCheck.Web.Services.Interfaces;
|
||||||
|
|
||||||
@@ -32,9 +33,20 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.CheckPoints
|
|||||||
return new JsonResult(new { data = CheckPoint.CheckListTemplateRowDTO });
|
return new JsonResult(new { data = CheckPoint.CheckListTemplateRowDTO });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnPostSave([FromBody] CheckPointDTO checkPointDTO)
|
public async Task<IActionResult> OnPostSave([FromBody] CheckPointDTO checkPointDTO)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _baseStockService.UpdateCheckPoint(checkPointDTO);
|
||||||
|
return new JsonResult(new { success = true });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResult(new { success = false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user