// GET: Client/Details/5
        public ActionResult Details(int id)
        {
            var client          = _serviceApp.GetById(id);
            var clientViewModel = _mapper.Map <ClientViewModel>(client);

            return(View(clientViewModel));
        }
Пример #2
0
        // GET: Clientes/Details/5
        public ActionResult Details(int id)
        {
            var client          = _clientAppService.GetById(id);
            var clientViewModel = AutoMapper.Mapper.Map <Client, ClientViewModel>(client);

            return(View(clientViewModel));
        }
Пример #3
0
        public Task <HttpResponseMessage> GetClientById(int clientId)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            try
            {
                var clientViewModel = Mapper.Map <Client, ClientViewModel>(_service.GetById(clientId));
                if (clientViewModel != null)
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, clientViewModel);
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.BadRequest, "Cliente não encontrado.");
                }
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
            }

            var tsc = new TaskCompletionSource <HttpResponseMessage>();

            tsc.SetResult(response);
            return(tsc.Task);
        }
Пример #4
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var clientViewModel = clientAppService.GetById((Guid)id);

            if (clientViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(clientViewModel));
        }
Пример #5
0
        public async Task <IActionResult> Edit(long id)
        {
            var client = await _clientAppService.GetById(id);

            var clientToEdit = ObjectMapper.Map <ClientViewModel>(client);

            return(View(clientToEdit));
        }
Пример #6
0
 public HttpResponseMessage Get(int id)
 {
     try
     {
         var client = _clientAppService.GetById(id);
         return(Request.CreateResponse(HttpStatusCode.OK, client));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }
Пример #7
0
        public ActionResult Create(Guid?clientId)
        {
            if (clientId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var clientViewModel = clientAppService.GetById((Guid)clientId);

            if (clientViewModel == null)
            {
                return(HttpNotFound());
            }

            var fieldViewModel = new FieldViewModel
            {
                ClientId = clientViewModel.ClientId
            };

            return(View(fieldViewModel));
        }
Пример #8
0
        public async Task <ClientViewModel> GetClient(Guid id)
        {
            var client = await clientAppService.GetById(id);

            return(client);
        }
Пример #9
0
        // GET:Sp/Clients/Edit/5
        public ActionResult Edit(int id)
        {
            var clientViewModel = Mapper.Map <Client, ClientViewModel>(_clientAppService.GetById(id));

            return(View(clientViewModel));
        }
Пример #10
0
 // GET: api/Clients/5
 public ClientViewModel Get(Guid id)
 {
     return(_clientAppService.GetById(id));
 }
Пример #11
0
 public ClientViewModel GetById(Guid id)
 {
     return(Mapper.Map <ClientViewModel>(_clientService.GetById(id)));
 }
Пример #12
0
        public async Task <IActionResult> Edit(Guid id)
        {
            var client = await clientAppService.GetById(id);

            return(View(client));
        }