Ejemplo n.º 1
0
        public async Task <ActionResult <TbLoaiCamNang> > PostTbLoaiCamNang(TbLoaiCamNang tbLoaiCamNang)
        {
            _context.TbLoaiCamNang.Add(tbLoaiCamNang);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTbLoaiCamNang", new { id = tbLoaiCamNang.LoaicamnangId }, tbLoaiCamNang));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("LoaicamnangId,LoaicamnangTieude")] TbLoaiCamNang tbLoaiCamNang)
        {
            if (id != tbLoaiCamNang.LoaicamnangId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tbLoaiCamNang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TbLoaiCamNangExists(tbLoaiCamNang.LoaicamnangId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbLoaiCamNang));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutTbLoaiCamNang(int id, TbLoaiCamNang tbLoaiCamNang)
        {
            if (id != tbLoaiCamNang.LoaicamnangId)
            {
                return(BadRequest());
            }

            _context.Entry(tbLoaiCamNang).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TbLoaiCamNangExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("LoaicamnangId,LoaicamnangTieude")] TbLoaiCamNang tbLoaiCamNang)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tbLoaiCamNang);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbLoaiCamNang));
        }