コード例 #1
0
 public ActionResult Add()
 {
     var model = new EventDetailModel();
     model.StartDateTime = DateTime.Now;
     var allCategories = EventCategoriesService.Get(new EventCategories()).EventCategories;
     model.AllEventCategories = new SelectList(allCategories, "Id", "Name");
     return View(model);
 }
コード例 #2
0
        public ActionResult Add(EventDetailModel model)
        {
            try
            {
                var eventEntity = model.ToEntity();
                eventEntity.StartDateTime = new DateTime(
                    model.StartDateTime.Year,
                    model.StartDateTime.Month,
                    model.StartDateTime.Day,
                    model.StartHour,
                    model.StartMinute,
                    0);

                EventService.Post(eventEntity);
                return RedirectToAction("Index", "Events");
            }
            catch (WebServiceException exception)
            {
                throw;
            }
        }