Exemple #1
0
        public async Task <ClientViewModel> GetClient(int clientID)
        {
            ClientEntity client = await _clientServices.GetClient(clientID);

            ProcessResult <ClientEntity>(client);
            return(Mapper.Map <ClientViewModel>(client));
        }
Exemple #2
0
 public ActionResult <Client> Get(Guid key)
 {
     try
     {
         return(Ok(_clientServices.GetClient(key)));
     }
     catch (Exception exception)
     {
         _logger.LogError(exception, exception.Message);
         return(new StatusCodeResult(500));
     }
 }
        public async Task <IActionResult> Create(FuturesViewModel futuresViewModel)
        {
            if (ModelState.IsValid)
            {
                futuresViewModel.Id = Guid.NewGuid();
                var client = _clientServices.ClientExistByDni(futuresViewModel.Client.Dni);
                if (futuresViewModel.RefeerCode != null)
                {
                    var refeer = await _clientServices.GetClient(futuresViewModel.RefeerCode);

                    futuresViewModel.Refeer = refeer.Id;
                }
                if (!client)
                {
                    await _clientServices.CreateClient(futuresViewModel.Client);
                }
                else
                {
                    await _clientServices.UpdateClient(futuresViewModel.Client);
                }

                if (futuresViewModel.FixRent)
                {
                    futuresViewModel.ParticipationId = null;
                }

                if (!NoLimitclient(futuresViewModel.ContractNumber))
                {
                    futuresViewModel.FinishDate = futuresViewModel.StartDate.AddMonths(6);
                }
                else
                {
                    futuresViewModel.FinishDate = futuresViewModel.StartDate.AddYears(99);
                }

                await _futuresServices.CreateFuture(futuresViewModel);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(Problem(ModelState.IsValid.ToString(), null, 400));
            }
        }
        public async Task <JsonResult> GetClient(string dni)
        {
            var client = await _clientServices.GetClient(dni);

            return(Json(client));
        }
        public Client GetClient(int ClientId)
        {
            var Client = _clientService.GetClient(ClientId);

            return(Client.ToClientModel());
        }
 public IActionResult GetClient(int id)
 {
     return(Ok(_clientServices.GetClient(id)));
 }