public ActionResult Create(WorkEvent workevent) { workevent.StartTime = DateTime.Now; workevent.EndTime = DateTime.Now; if (ModelState.IsValid) { db.WorkEvents.Add(workevent); db.SaveChanges(); return RedirectToAction("Index"); } return View(workevent); }
// // GET: /WorkEvent/Create public ActionResult Create() { WorkEvent workevent = new WorkEvent(); workevent.UserName = ""; if (Request.IsAuthenticated) { //if (user != null) //{ //workevent.UserID = User.Identity. workevent.UserName = User.Identity.Name; //} } workevent.StartTime = DateTime.Now; workevent.EndTime = DateTime.Now; //ViewData.Model = WorkEvent; return View(workevent); }
public ActionResult Edit(WorkEvent workevent) { if (ModelState.IsValid) { db.Entry(workevent).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(workevent); }