// GET: /Consulta/Create public ActionResult Create(Guid idpaciente) { try { PacienteDto paciente = _pacienteService.Get(idpaciente); FormConsulta form = new FormConsulta(); if (paciente != null) { form.IdPaciente = idpaciente; } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewBag.Podologos = new SelectList(_primeraVisitaService.GetPodologos(), "Nombre", "IdPodologo"); return(View(form)); } catch (Exception ex) { _log.Error($"[Method: Create(Guid idPaciente)] -> {ex}"); return(Redirect("~/Error/Error")); } }
// GET: /PrimeraVisita/Edit public ActionResult Edit(Guid?idvisita) { try { if (idvisita == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PrimeraVisitaDto visita = _primeraVisitaService.Get((Guid)idvisita); if (visita == null) { return(HttpNotFound()); } FormPrimeraVisita form = visita.PrimeraVisitaDtoToFormPrimeraVisita(); ViewBag.Podologos = new SelectList(_primeraVisitaService.GetPodologos(), "Nombre", "IdPodologo", form.IdPodologo); return(View(form)); } catch (Exception ex) { _log.Error($"[Method: Edit(Guid? idvisita)] -> {ex}"); return(Redirect("~/Error/Error")); } }
public void GetPodologos_Returns_Ok() { //Arrange var idPersona = Guid.NewGuid(); var podologoList = new List <PodologoModel>() { new PodologoModel() { id_persona = idPersona, idPodologo = Guid.NewGuid() } }; _podologoRepositoryMock.Expects.AtLeast(1).Method(x => x.GetAllIds()).WillReturn(podologoList); _personaRepositoryMock.Expects.AtLeast(1).Method(x => x.GetByIdList(new List <Guid>() { idPersona })).WithAnyArguments() .WillReturn(new List <PersonaModel> { new PersonaModel() { idPersona = idPersona, nombre = "Jairo" } }); //Act var result = _primeraVisitaService.GetPodologos(); //Assert Assert.AreEqual(result[0].IdPersona, idPersona); Assert.AreEqual(result[0].IdPodologo, podologoList[0].idPodologo); Assert.AreEqual(result[0].Nombre, "Jairo"); }