コード例 #1
0
ファイル: LokalController.cs プロジェクト: annaendi/EmpTest
        public IActionResult Update(Lokal updatedLokal)
        {
            var lokal = _context.Lokal.FirstOrDefault(l => l.IdLokalu == updatedLokal.IdLokalu);

            if (lokal == null)
            {
                return(NotFound());
            }
            _context.Lokal.Attach(updatedLokal);
            _context.Entry(updatedLokal).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(Ok(updatedLokal));
        }
コード例 #2
0
        public IActionResult Update(Promocja updatedPromocja)
        {
            var promocja = _context.Promocja.FirstOrDefault(p => p.IdPromocja == updatedPromocja.IdPromocja);

            if (promocja == null)
            {
                return(NotFound());
            }
            _context.Promocja.Attach(updatedPromocja);
            _context.Entry(updatedPromocja).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(Ok(updatedPromocja));
        }
コード例 #3
0
        public IActionResult Update(Skladnik updatedSkladnik)
        {
            var skladnik = _context.Skladnik.FirstOrDefault(s => s.IdSkladnik == updatedSkladnik.IdSkladnik);

            if (skladnik == null)
            {
                return(NotFound());
            }
            _context.Skladnik.Attach(updatedSkladnik);
            _context.Entry(updatedSkladnik).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(Ok(updatedSkladnik));
        }