-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prueba Técnica Marcos Sánchez Hernández #2
Open
zikram013
wants to merge
8
commits into
calujord:main
Choose a base branch
from
zikram013:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3b90791
Esqueleto de archivos necesarios
zikram013 1c9e300
Entidades,Modelos,Dtos y cadena de conexion
zikram013 a16c6cc
Controller GetId
zikram013 6bd56c2
Codificion del servicio para traer los datos y para buscarlos por pri…
zikram013 09893cb
Solucion de diversos Fixes y pruebas
zikram013 650649c
pruebas
zikram013 89a01b7
Limpieza de codigo y proyecto
zikram013 9f154a7
Se agrega el patron Repository
zikram013 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.03 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/1142cc64-b03d-4a0b-93db-b84a3586d92d.vsidx
Binary file not shown.
Binary file removed
BIN
-3.08 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/3108df33-1390-401a-89c1-67986dd7f85e.vsidx
Binary file not shown.
Binary file added
BIN
+9.15 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/4e447ec5-bccd-4cba-9889-883c4798c4f7.vsidx
Binary file not shown.
Binary file removed
BIN
-4.92 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/4fab8682-faa1-491f-b457-9ab64592d7cc.vsidx
Binary file not shown.
Binary file added
BIN
+6.83 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/6b62534a-5cf9-40f7-b881-26dfd06625ff.vsidx
Binary file not shown.
Binary file removed
BIN
-3.49 KB
PruebaTecnica/.vs/PruebaTecnica/FileContentIndex/9752b693-3c64-4da7-a85a-9bb5aa971331.vsidx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using PruebaTecnica.Servicio.Interfaz; | ||
|
||
namespace PruebaTecnica.Controllers | ||
{ | ||
[ApiController] | ||
[Route("MarketPartiesController")] | ||
public class MarketPartiesController : ControllerBase | ||
{ | ||
private readonly ILogger<MarketPartiesController> _logger; | ||
private readonly IBalanceResponsiblePartyService _balance; | ||
|
||
public MarketPartiesController(ILogger<MarketPartiesController> logger, IBalanceResponsiblePartyService balance) | ||
{ | ||
_logger = logger; | ||
_balance = balance; | ||
} | ||
|
||
|
||
[HttpGet(Name = "ObtenerDatosApi")] | ||
public IActionResult ObtenerDatosApi() | ||
{ | ||
_logger.LogInformation("Entramos en el metodo"); | ||
var result = _balance.Save(); | ||
if (result.Data.CodigoResultado == 0) | ||
{ | ||
return Ok("Datos guardados correctamente"); | ||
} | ||
else | ||
{ | ||
return NotFound(); | ||
} | ||
} | ||
|
||
[HttpGet(Name = "Data/{id}")] | ||
public IActionResult GetDataById(int id) | ||
{ | ||
_logger.LogInformation("Entramos en el método"); | ||
|
||
var result = _balance.ObtenerBalance(id); | ||
|
||
if (result.Data.CodigoResultado == 0) | ||
{ | ||
return Ok(result.Data); | ||
} | ||
else | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace PruebaTecnica.Genericos | ||
{ | ||
|
||
public enum ResultType | ||
{ | ||
Ok,NotFound,BadArguments | ||
} | ||
public class ServiceResult<T> | ||
{ | ||
public ServiceResult() | ||
{ | ||
Type=ResultType.Ok; | ||
Errors=new List<string>(); | ||
Messages=new List<string>(); | ||
} | ||
|
||
public T Data { get; set; } | ||
public ResultType Type { get; set; } | ||
public List<string>Errors { get; set; } | ||
public List<string> Messages { get; set; } | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,59 @@ | ||
namespace PruebaTecnica.Servicio | ||
using PruebaTecnica.ContextoBBDD; | ||
using PruebaTecnica.DTO; | ||
using PruebaTecnica.Genericos; | ||
using PruebaTecnica.Models; | ||
using PruebaTecnica.Servicio.Interfaz; | ||
|
||
namespace PruebaTecnica.Servicio | ||
{ | ||
public class BalanceResponsibleService | ||
public class BalanceResponsibleService : IBalanceResponsiblePartyService | ||
{ | ||
private readonly ApplicationContext _context; | ||
|
||
public BalanceResponsibleService(ApplicationContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
public ServiceResult<BalanceReponsiblePartiesModels> GetData(int id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Añadir el patrón de comentarios sobre obtener la información de los datos o colocar una breve descripción de lo que hace el método, |
||
{ | ||
var result = new ServiceResult<BalanceReponsiblePartiesModels>(); | ||
|
||
var data = _context.BalanceResponsibles.FirstOrDefault(x => x.Id == id); | ||
|
||
if (data == null) | ||
{ | ||
result.Data = new BalanceReponsiblePartiesModels() | ||
{ | ||
CodigoResultado = 1, | ||
BalanceResponsible = null | ||
}; | ||
return result; | ||
} | ||
|
||
var dataDto = new BalanceReponsiblePartiesDTO | ||
{ | ||
BrpCode=data.BrpCode, | ||
BrpName=data.BrpName, | ||
BusinessId=data.BusinessId, | ||
CodingScheme=data.CodingScheme, | ||
Country=data.Country, | ||
ValidityEnd= data.ValidityEnd, | ||
ValidityStart= data.ValidityStart | ||
}; | ||
|
||
result.Data = new BalanceReponsiblePartiesModels() | ||
{ | ||
CodigoResultado = 0, | ||
BalanceResponsible = dataDto | ||
}; | ||
|
||
return result; | ||
} | ||
|
||
public ServiceResult<BalanceReponsiblePartiesModels> Save() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
PruebaTecnica/Servicio/Interfaz/IBalanceResponsiblePartyService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using PruebaTecnica.Genericos; | ||
using PruebaTecnica.Models; | ||
|
||
namespace PruebaTecnica.Servicio.Interfaz | ||
{ | ||
public interface IBalanceResponsiblePartyService | ||
{ | ||
ServiceResult<BalanceReponsiblePartiesModels> Save(); | ||
ServiceResult<BalanceReponsiblePartiesModels> GetData(int id); | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
PruebaTecnica/Servicio/Interfaz/IBalanceResponsibleService.cs
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Añadir breves comentarios de lo que hace el controlador