public ActionResult Create(NewTaskViewModel viewModel) { var task = Mapper.Map<NewTaskViewModel, Task>(viewModel); _session.Store(task); return Json(Mapper.Map<Task, TaskViewModel>(task)); }
private static IEnumerable<string> GetTags(NewTaskViewModel viewModel) { return from Match match in Regex.Matches(viewModel.Name, @"\#(\w+)") select match.Groups[1].Value; }
private static string GetName(NewTaskViewModel viewModel) { return viewModel.Name.Substring(0, viewModel.Name.IndexOf("#") - 1); }