Ejemplo n.º 1
0
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var ordemServiceViewModel = await _ordemServicoAppService.GetById(id.Value);

            if (ordemServiceViewModel == null)
            {
                return(NotFound());
            }

            return(View(ordemServiceViewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(Guid?id, OrdemServicoExameViewModel ordemServicoExameViewModel)
        {
            ordemServicoExameViewModel.OrdemServico = await _ordemServicoAppService.GetById(id.Value);

            bool hasErrors = !ModelState.IsValid;

            if (!hasErrors)
            {
                hasErrors = ResponseHasErrors(await _ordemServicoExameAppService.Add(ordemServicoExameViewModel));
            }

            if (hasErrors)
            {
                ViewData["ExameId"]        = new SelectList(await _exameAppService.GetAll(), "Id", "Nome", ordemServicoExameViewModel.Exame?.Id);
                ViewData["OrdemServicoId"] = id;

                return(View(ordemServicoExameViewModel));
            }

            ViewBag.Sucesso = "Item registrado!";

            return(RedirectToAction("edit", "ordem", new { Id = id }));
        }
 public async Task <OrdemServicoViewModel> Get(Guid id)
 {
     return(await _ordemServicoAppService.GetById(id));
 }