예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("LoaiChiPhiId,LoaiChiPhiTen,LoaiChiPhiMoTa,NgayTao")] TourLoaiChiPhi tourLoaiChiPhi)
        {
            if (id != tourLoaiChiPhi.LoaiChiPhiId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    context.Update(tourLoaiChiPhi);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TourLoaiChiPhiExists(tourLoaiChiPhi.LoaiChiPhiId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tourLoaiChiPhi));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("LoaiChiPhiId,LoaiChiPhiTen,LoaiChiPhiMoTa,NgayTao")] TourLoaiChiPhi tourLoaiChiPhi)
        {
            if (ModelState.IsValid)
            {
                context.Add(tourLoaiChiPhi);
                await context.SaveChangesAsync();

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