Example #1
0
        public async Task <IActionResult> Edit(int id, string returnUrl, [Bind("Id,Cdp1,Cdp2,Daudit,Drenum,Dnom,Desos,Drisk,Dexec,Dtender,Duration,Directorid,Companyid,SessionId")] Directorship directorship)
        {
            if (id != directorship.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(directorship);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DirectorshipExists(directorship.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
                return(Redirect(returnUrl));
            }
            //ViewData["Companyid"] = new SelectList(_context.Companies, "Id", "Companyname", directorship.Companyid);
            //ViewData["Directorid"] = new SelectList(_context.Directors, "Id", "Name", directorship.Directorid);
            //ViewData["SessionId"] = new SelectList(_context.Sessions, "Id", "Sessionyear", directorship.SessionId);
            return(View(directorship));
        }
Example #2
0
        public async Task <IActionResult> AttachDirector([Bind("Id,Cdp1,Cdp2,Daudit,Drenum,Dnom,Drisk,Dexec,Dtender,DfinanceDuration,Directorid,Companyid,SessionId")] Directorship directorship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(directorship);
                await _context.SaveChangesAsync();

                return(Redirect("/Directorships/GetCompanyDirectors/" + directorship.Companyid));
            }
            return(Redirect("/Directorships/Company/" + directorship.Companyid + "/Session/" + directorship.SessionId));
        }
Example #3
0
        public async Task <IActionResult> AttachDirectorToNewCompany([Bind("Id,Cdp1,Cdp2,Daudit,Drenum,Dnom,Duration,Directorid,Companyid,SessionId")] Directorship directorship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(directorship);
                await _context.SaveChangesAsync();

                return(Redirect("/Directorships/GetCompanyDirectors/" + directorship.Companyid));
            }
            return(View(directorship));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("Id,Cdp1,Cdp2,Daudit,Drenum,Dnom,Desos,Drisk,Dexec,Dtender,Dfinance,Duration,Directorid,Companyid,SessionId")] Directorship directorship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(directorship);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Companyid"]  = new SelectList(_context.Companies, "Id", "Companyname", directorship.Companyid);
            ViewData["Directorid"] = new SelectList(_context.Directors, "Id", "Name", directorship.Directorid);
            ViewData["SessionId"]  = new SelectList(_context.Sessions, "Id", "Sessionyear", directorship.SessionId);
            return(View(directorship));
        }