Пример #1
0
        public ActionResult Create(EventBlockCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            if (EventBlockService.CreateEvent(model))
            {
                TempData["SaveResult"] = "Your event was created";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Event could not be created");
            return(View(model));
        }
        public bool CreateEvent(EventBlockCreate model)
        {
            var entity =
                new Data.Event()
            {
                Title       = model.Title,
                IsAllDay    = model.IsAllDay,
                Start       = model.Start,
                End         = model.End,
                Description = model.Description,
                ThemeColor  = model.ThemeColor,
            };

            using (var ctx = new StudyTimeHelperEntities())
            {
                ctx.Event.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #3
0
 public bool EventCreate(EventBlockCreate model)
 {
     throw new NotImplementedException();
 }
Пример #4
0
 public bool CreateEvent(EventBlockCreate model)
 {
     CreateEventCallCount++;
     return(CreateEventReturnValue);
 }