예제 #1
0
        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);
        }
예제 #2
0
        //
        // 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);
        }
예제 #3
0
 public ActionResult Edit(WorkEvent workevent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workevent).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(workevent);
 }