Exemplo n.º 1
0
        public async Task <IActionResult> Upsert(int?id)
        {
            IEnumerable <PatientDetail> pdList = await _pdRepo.GetAllAsync(SD.PatientDetailsAPIPath + "all/", HttpContext.Session.GetString("JWToken"));

            TempVM objVM = new TempVM()
            {
                PatientList = pdList.Select(i => new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem
                {
                    Text  = i.Name + i.Lastname,
                    Value = i.UserId.ToString()
                }),
                Temp = new Temp()
            };

            if (id == null)
            {
                // for Insert/Create
                return(View(objVM));
            }

            // For Update
            objVM.Temp = await _tRepo.GetAsync(SD.TemperaturesLogEntryAPIPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWToken"));

            if (objVM.Temp == null)
            {
                return(NotFound());
            }

            return(View(objVM));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            IndexVM listOfPatientsAndTemps = new IndexVM()
            {
                PatientList = await _pdRepo.GetAllAsync(SD.PatientDetailsAPIPath + "all/", HttpContext.Session.GetString("JWToken")),
                TempList    = await _tRepo.GetAllAsync(SD.TemperaturesLogEntryAPIPath, HttpContext.Session.GetString("JWToken")),
            };

            return(View(listOfPatientsAndTemps));
        }
 public async Task <IActionResult> GetPatientDetails()
 {
     return(Json(new { data = await _pdRepo.GetAllAsync(SD.PatientDetailsAPIPath + "all/", HttpContext.Session.GetString("JWToken")) }));
 }