示例#1
0
        public async Task <IActionResult> Create([Bind("Badaniaid,Hemoglobina,Temperatura,Cisnienie,Tetno,Kartaid")] Badania badania)
        {
            if (ModelState.IsValid)
            {
                _context.Add(badania);
                await _context.SaveChangesAsync();

                _context.Attach(badania).State = EntityState.Detached;
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Kartaid"] = new SelectList(_context.Kartazdrowia, "Kartaid", "Kartaid", badania.Kartaid);
            return(View(badania));
        }
示例#2
0
 public Badanie(string numer, DateTime dataWystawienia, DateTime dataWaznosci, string uwagi)
 {
     badanieDb = new Badania();
     Numer     = numer;
     if (dataWystawienia != DateTime.MinValue)
     {
         DataWystawienia = dataWystawienia;
     }
     if (dataWaznosci != DateTime.MinValue)
     {
         DataWaznosci = dataWaznosci;
     }
     Uwagi = uwagi;
 }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Badaniaid,Hemoglobina,Temperatura,Cisnienie,Tetno,Kartaid")] Badania badania)
        {
            if (id != badania.Badaniaid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var badanie = await _context.Badania.AsNoTracking().FirstOrDefaultAsync(x => x.Badaniaid == badania.Badaniaid);

                    badanie.Badaniaid   = badania.Badaniaid;
                    badanie.Kartaid     = badania.Kartaid;
                    badanie.Cisnienie   = badania.Cisnienie;
                    badanie.Hemoglobina = badania.Hemoglobina;
                    badanie.Temperatura = badania.Temperatura;
                    badanie.Tetno       = badania.Tetno;

                    _context.Update(badanie);
                    //_context.Entry(badanie).State = EntityState.Modified;

                    await _context.SaveChangesAsync();

                    _context.Entry(badanie).State = EntityState.Detached;
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BadaniaExists(badania.Badaniaid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Kartaid"] = new SelectList(_context.Kartazdrowia, "Kartaid", "Kartaid", badania.Kartaid);
            return(View(badania));
        }
示例#4
0
 public Badanie(Badania badania)
 {
     badanieDb = badania;
 }
示例#5
0
 public Badanie()
 {
     badanieDb = new Badania();
 }