Guest User

Untitled

a guest
Nov 18th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1.         [HttpGet]
  2.         public ActionResult Create1()
  3.         {
  4.             ViewBag.PaintballBundleID = new SelectList(dc.PaintballBundles, "PaintballBundleID", "Nazwa");
  5.             return View(new Event
  6.             {
  7.                 Start = Convert.ToDateTime(Request.QueryString["start"]),
  8.                 End = Convert.ToDateTime(Request.QueryString["end"])
  9.             });
  10.         }
  11.  
  12.         [HttpPost]
  13.         public ActionResult Create1(FormCollection form)
  14.         {
  15.             DateTime start = Convert.ToDateTime(form["Start"]);
  16.             DateTime end = Convert.ToDateTime(form["End"]);
  17.             int iloscosob = Convert.ToInt32(form["IloscOsob"]);
  18.             int resource = Convert.ToInt32(form["Resource"]);
  19.             //string recurrence = form["Recurrence"];
  20.  
  21.             var toBeCreated = new Event() { Start = start, End = end, IloscOsob = iloscosob};
  22.             dc.Events.Add(toBeCreated);
  23.             dc.SaveChanges();
  24.  
  25.             return JavaScript(SimpleJsonSerializer.Serialize("OK"));
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment