예제 #1
0
        public async Task <IActionResult> PutSenator(int id, Senator senator)
        {
            if (id != senator.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Senator> > PostSenator(Senator senator)
        {
            _context.Senators.Add(senator);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSenator", new { id = senator.Id }, senator));
        }
예제 #3
0
        public IActionResult ReadSenator(int SenatorID)
        {
            Senator senator = _context.Senators.Find(SenatorID);

            //Senator senator = applicationDbContext.Senators.Single(c => c.SenatorID == ReadSenatorViewModel.SenatorID);
            //senator = senator.Include(s => s.State).Include(p => p.Party).ToList();
            ViewBag.mySenator = senator;
            return(View());
        }
예제 #4
0
        private void senatorVotationProcess(Senator senator, bool vote)
        {
            senator.pages.pageVotation = new PageVotation(senator.driver);

            if (vote)
            {
                senator.pages.pageVotation.clkVotarSi();
            }
            else
            {
                senator.pages.pageVotation.clkVotarNo();
            }
        }
예제 #5
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(0, 27, true);
            WriteLiteral("\r\n<h2>Read Senator</h2>\r\n\r\n");
            EndContext();
#line 4 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"

            Senator senator = ViewBag.mySenator;

#line default
#line hidden
            BeginContext(77, 25, true);
            WriteLiteral("\r\n<div>\r\n    SenatorID : ");
            EndContext();
            BeginContext(103, 17, false);
#line 9 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.SenatorID);

#line default
#line hidden
            EndContext();
            BeginContext(120, 25, true);
            WriteLiteral(" <br />\r\n    Full Name : ");
            EndContext();
            BeginContext(146, 19, false);
#line 10 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.SenatorName);

#line default
#line hidden
            EndContext();
            BeginContext(165, 45, true);
            WriteLiteral(" <br />\r\n    Represents State in Congress :  ");
            EndContext();
            BeginContext(211, 15, false);
#line 11 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.StateID);

#line default
#line hidden
            EndContext();
            BeginContext(226, 1, true);
            WriteLiteral(" ");
            EndContext();
            BeginContext(255, 7, true);
            WriteLiteral("<br /> ");
            EndContext();
            BeginContext(293, 38, true);
            WriteLiteral("\r\n    Represents party in Congress :  ");
            EndContext();
            BeginContext(332, 15, false);
#line 12 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.PartyID);

#line default
#line hidden
            EndContext();
            BeginContext(347, 1, true);
            WriteLiteral(" ");
            EndContext();
            BeginContext(376, 7, true);
            WriteLiteral("<br /> ");
            EndContext();
            BeginContext(414, 12, true);
            WriteLiteral("\r\n    Age : ");
            EndContext();
            BeginContext(427, 11, false);
#line 13 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.Age);

#line default
#line hidden
            EndContext();
            BeginContext(438, 46, true);
            WriteLiteral(" <br />\r\n    Date Oath of Officer was taken : ");
            EndContext();
            BeginContext(485, 19, false);
#line 14 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.YearsServed);

#line default
#line hidden
            EndContext();
            BeginContext(504, 39, true);
            WriteLiteral(" <br />\r\n    Seat up for Election in : ");
            EndContext();
            BeginContext(544, 14, false);
#line 15 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.SeatUp);

#line default
#line hidden
            EndContext();
            BeginContext(558, 26, true);
            WriteLiteral(" <br />\r\n    Occupation : ");
            EndContext();
            BeginContext(585, 18, false);
#line 16 "C:\Users\Jesse\source\repos\FinishIt\FinishIt\Views\Senator\ReadSenator.cshtml"
            Write(senator.Occupation);

#line default
#line hidden
            EndContext();
            BeginContext(603, 24, true);
            WriteLiteral("\r\n</div>\r\n<br/>\r\n<br/>\r\n");
            EndContext();
            BeginContext(627, 75, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "508011cbac6e4bbd8a2634f17241a325", async() => {
                BeginContext(674, 24, true);
                WriteLiteral("Back to Senator Selector");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
        }