Пример #1
0
        public ActionResult Create(MeetingViewModel meetingModel)
        {
            if (ModelState.IsValid)
            {
                int id = -1;
                var userId = User.Identity.GetUserId();
                var meeting =  CommonMapper.Map(meetingModel);
                meeting.creator = userId;
                var meetingRep = new MeetingRepository();

                id = meetingRep.Create(meeting);
                if (id > -1)
                {
                    Notify.NewMeeting(meeting);
                    return RedirectToAction("Get", new { id = id });
                }
                throw new Exception();
            }
            else
                return View(meetingModel);
        }
Пример #2
0
 public static Meeting Map(MeetingViewModel viewModel)
 {
     return (Meeting)new CommonMapper().Map(viewModel, typeof(MeetingViewModel), typeof(Meeting));
 }