예제 #1
0
 public void Handle(string name, string description, string scheduledFor)
 {
     meetupRepository.Add(Meetup.Schedule(
                              Name.FromString(name),
                              Description.FromString(description),
                              DateTimeOffset.Parse(scheduledFor)));
 }
예제 #2
0
        public void Handle(string name, string description, string scheduledFor)
        {
            Guid id = Guid.NewGuid();

            meetupRepository.Add(Meetup.Schedule(id,
                                                 Name.FromString(name),
                                                 Description.FromString(description),
                                                 DateTimeOffset.Parse(scheduledFor)));
            created(id);
        }
        public IActionResult Schedule(ScheduleMeetup meetup)
        {
            if (string.IsNullOrEmpty(meetup.Name))
            {
                ModelState.AddModelError("Name", "Name cannot be empty");
            }

            if (string.IsNullOrEmpty(meetup.Description))
            {
                ModelState.AddModelError("Description", "Description cannot be empty");
            }

            if (!ModelState.IsValid)
            {
                return(View(meetup));
            }

            meetupRepository.Add(Meetup.Schedule(
                                     Name.FromString(meetup.Name),
                                     Description.FromString(meetup.Description),
                                     meetup.ScheduledFor));

            return(RedirectToAction("Index"));
        }