コード例 #1
0
        public ActionResult Delete(int id)
        {
            try
            {
                service.DeleteTimeslot(id);

                return RedirectToAction("Index");
            }
            catch // (Exception e)
            {
                ViewBag.ErrorMessage = "This Timeslot can not be deleted";

                var timeslot = service.GetTimeslot(id);

                Timeslot model = new Timeslot()
                {
                    ID = timeslot.ID,
                    EventID = timeslot.EventID,
                    Name = timeslot.Name,
                    StartTime = timeslot.StartTime,
                    EndTime = timeslot.EndTime
                };

                return View("Details", model);
            }
        }
コード例 #2
0
        public ActionResult Create(Timeslot timeslot)
        {
            try
            {
                service.CreateTimeslot(new CC.Service.Webhost.Services.Timeslot()
                {
                    EventID = timeslot.EventID,
                    Name = timeslot.Name,
                    StartTime = timeslot.StartTime,
                    EndTime = timeslot.EndTime
                });

                return RedirectToAction("Index");
            }
            catch
            {
                return View(timeslot);
            }
        }
コード例 #3
0
        //
        // GET: /Timeslot/Details/5
        public ActionResult Details(int id)
        {
            var timeslot = service.GetTimeslot(id);

            Timeslot model = new Timeslot()
            {
                ID = timeslot.ID,
                EventID = timeslot.EventID,
                Name = timeslot.Name,
                StartTime = timeslot.StartTime,
                EndTime = timeslot.EndTime
            };

            return View(model);
        }
コード例 #4
0
        public ActionResult Create(int eventid)
        {
            Timeslot model = new Timeslot() { EventID = eventid };

            return View(model);
        }