예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Movie_Producer_ID,Movie_Producer_Name,Movie_Producer_Email,Movie_Producer_Mobile,Movie_Producer_Occupations")] Producer_details producer_details)
        {
            if (id != producer_details.Movie_Producer_ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(producer_details);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Producer_detailsExists(producer_details.Movie_Producer_ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(producer_details));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Movie_Producer_ID,Movie_Producer_Name,Movie_Producer_Email,Movie_Producer_Mobile,Movie_Producer_Occupations")] Producer_details producer_details)
        {
            if (ModelState.IsValid)
            {
                _context.Add(producer_details);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(producer_details));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Producer_details = await _context.Producer_details.FirstOrDefaultAsync(m => m.Movie_Producer_ID == id);

            if (Producer_details == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Producer_details = await _context.Producer_details.FindAsync(id);

            if (Producer_details != null)
            {
                _context.Producer_details.Remove(Producer_details);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }