public ActionResult New(FormCollection form) { DateTime start = Convert.ToDateTime(form["Start"]); DateTime end = Convert.ToDateTime(form["End"]); string text = form["Text"]; string teacherName = form["TeacherName"]; int roomNumber = 0; Int32.TryParse(form["RoomNumber"], out roomNumber); EventViewModel @event = new EventViewModel { TimeTableId = new Guid(this.Session["TimeTableId"].ToString()), Start = start, End = end, Text = text, TeacherName = teacherName, RoomNumber = roomNumber }; EventDTO eventDto = _mapper.Map <EventViewModel, EventDTO>(@event); _timeTableService.AddEvent(eventDto); return(JavaScript(SimpleJsonSerializer.Serialize("OK"))); }