SHARE
TWEET

Untitled

a guest Mar 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @using (Html.BeginForm("AddClub", "Club", FormMethod.Post, new { @class = "form-horizontal" }))
  2.     {
  3.         <div class="form-group">
  4.             <label class="control-label col-sm-3">Club Sponser:</label>
  5.             <div class="col-sm-4">
  6.                 @Html.TextBox("ClubSponser", null, new { @class = "form-control", id = "ClubSponser", placeholder = "Enter club Sponser" })
  7.             </div>
  8.         </div>
  9.         <div class="btn-toolbar col-md-offset-7" role="group">
  10.             <button type="submit" onsubmit="AddClub("ClubName","ClubOwner","ClubCoach","ClubSponser")" class="btn btn-primary">Add Club</button>
  11.             <a href="@Url.Action("Index", "Home")" class="btn btn-danger">Cancel</a>
  12.         </div>
  13.     }
  14.      
  15. [HttpPost]
  16.     public ActionResult AddClub(string ClubName,string ClubOwner,string ClubCoach,string ClubSponser)
  17.     {
  18.         Club club = new Club()
  19.         {
  20.             Name = ClubName,
  21.             Owner = ClubOwner,
  22.             Coach=ClubCoach,
  23.             Sponser=ClubSponser
  24.         };
  25.         clubRepo.AddClub(club);
  26.         return RedirectToAction("Index","Club");
  27.     }
  28.      
  29. public async Task AddClub(Club club)
  30.     {
  31.         _context.Clubs.Add(club);
  32.         await _context.SaveChangesAsync();
  33.     }
  34.      
  35. services.AddSingleton<IClubRepo, ClubService>();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top