public ActionResult Detalji(int pregledID) { HistorijaVM model = new HistorijaVM(); model.IzvUsluga = ctx.IzvrsenaUslugas.Include(f => f.Usluga).Include(f => f.Zub).Where(v => v.PregledId == pregledID). Select(o => new HistorijaVM.IzvrsenaUsluga { Naziv = ctx.Uslugas.FirstOrDefault(u => u.Id == o.UslugaId).Vrsta, Cijena = o.Cijena, IzvrsenaId = o.Id, NazivZuba = ctx.Zubs.FirstOrDefault(u => u.Id == o.ZubId).NazivZuba }).ToList(); model.UspDijagnoza = ctx.UspostavljenaDijagnozas.Include(f => f.Dijagnoza).Where(v => v.PregledId == pregledID). Select(o => new HistorijaVM.UspostavljenaDijagnoza { UspId = o.Id, Naziv = ctx.Dijagnozas.FirstOrDefault(u => u.Id == o.DijagnozaId).Naziv, Napomena = o.Napomena }).ToList(); model.Lijek = ctx.Terapijas.Include(f => f.Lijek).Where(v => v.PregledId == pregledID). Select(o => new HistorijaVM.Terapija { TerapijaId = o.Id, Lijek = ctx.Lijeks.FirstOrDefault(u => u.Id == o.LijekId).Naziv, Kolicina = o.Količina }).ToList(); return(View("Detalji", model)); }
public ActionResult Index(int?page, DateTime?from, DateTime?to) { Korisnik k = Autentifikacija.GetLogiraniKorisnik(HttpContext); int o = k.Pacijent.Id; IPagedList <Pregled> op; if (from != null && to != null) { op = ctx.Pregleds.Where(c => c.PacijentId == o && c.DatumPregleda >= from && c.DatumPregleda <= to).ToList().ToPagedList(page ?? 1, 3); } else if (from != null || to != null) { op = ctx.Pregleds.Where(c => c.PacijentId == o && (c.DatumPregleda >= from || c.DatumPregleda <= to)).ToList().ToPagedList(page ?? 1, 3); } else { op = ctx.Pregleds.Where(c => c.PacijentId == o).ToList().ToPagedList(page ?? 1, 3); } HistorijaVM model = new HistorijaVM { }; model.PregledList = op; return(View(model)); }
public ActionResult Index(int?page, int?pacijentid) { int o = pacijentid ?? 0; IPagedList <Pregled> op; op = ctx.Pregleds.Where(c => c.PacijentId == o).ToList().ToPagedList(page ?? 1, 3); HistorijaVM model = new HistorijaVM { }; model.PregledList = op; model.pacijent = ctx.Pacijents.Include(c => c.Korisnik).Where(c => c.Id == o).FirstOrDefault().Korisnik.Ime + " " + ctx.Pacijents.Include(c => c.Korisnik).Where(c => c.Id == o).FirstOrDefault().Korisnik.Prezime; return(View(model)); }
public ActionResult Pregledi(int PacijentId) { List <HistorijaVM.HistorijaInfo> pregledInfo = new List <HistorijaVM.HistorijaInfo>(); pregledInfo = ctx.Pregleds.ToList().Where(c => c.PacijentId == PacijentId) .Select(x => new HistorijaVM.HistorijaInfo { Id = x.Id, DatumPregleda = x.DatumPregleda, VrijemePregleda = x.VrijemePregleda, PacijentId = x.PacijentId, Uneseno = IsUneseno(x.Id), }).ToList(); HistorijaVM model = new HistorijaVM { history = pregledInfo, }; // model.Uneseno = IsUneseno(item.Id); return(View(model)); }
public Historija() { InitializeComponent(); BindingContext = model = new HistorijaVM(); }