Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,CompanyDescription")] Company company)
        {
            if (id != company.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName")] Actor actor)
        {
            if (id != actor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(actor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActorExists(actor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(actor));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,BornYear")] Producer producer)
        {
            if (id != producer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(producer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProducerExists(producer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(producer));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,MovieTitle,LanguageId,Prod_year,MovieDescription,ProducerId,CompanyId")] Movie movie)
        {
            if (id != movie.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieExists(movie.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyId"]  = new SelectList(_context.Company, "Id", "Id", movie.CompanyId);
            ViewData["LanguageId"] = new SelectList(_context.Language, "Id", "Id", movie.LanguageId);
            ViewData["ProducerId"] = new SelectList(_context.Producer, "Id", "Id", movie.ProducerId);
            return(View(movie));
        }
Beispiel #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code")] Language language)
        {
            if (id != language.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(language);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LanguageExists(language.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(language));
        }