public ActionResult Edit(Guid id, ViewModels.Notes.NoteViewModel viewModel) { Common.Models.Account.Users currentUser; Common.Models.Notes.Note model; currentUser = Data.Account.Users.Get(User.Identity.Name); model = Mapper.Map <Common.Models.Notes.Note>(viewModel); model.Body = new Ganss.XSS.HtmlSanitizer().Sanitize(model.Body); model = Data.Notes.Note.Edit(model, currentUser); if (viewModel.NotifyContactIds != null) { viewModel.NotifyContactIds.Each(x => { Data.Notes.NoteNotification.Create(new Common.Models.Notes.NoteNotification() { Contact = new Common.Models.Contacts.Contact() { Id = int.Parse(x) }, Note = model, Cleared = null }, currentUser); }); } return(RedirectToAction("Details", new { Id = id })); }
public ActionResult Create(ViewModels.Notes.NoteViewModel viewModel) { Common.Models.Account.Users currentUser; Common.Models.Notes.Note model; Guid matterid, eventid; long taskid; currentUser = Data.Account.Users.Get(User.Identity.Name); model = Mapper.Map <Common.Models.Notes.Note>(viewModel); model.Body = new Ganss.XSS.HtmlSanitizer().Sanitize(model.Body); model = Data.Notes.Note.Create(model, currentUser); if (viewModel.NotifyContactIds != null) { viewModel.NotifyContactIds.Each(x => { Data.Notes.NoteNotification.Create(new Common.Models.Notes.NoteNotification() { Contact = new Common.Models.Contacts.Contact() { Id = int.Parse(x) }, Note = model, Cleared = null }, currentUser); }); } if (Request["MatterId"] != null) { matterid = Guid.Parse(Request["MatterId"]); Data.Notes.Note.RelateMatter(model, matterid, currentUser); return(RedirectToAction("Details", "Matters", new { Id = matterid })); } else if (Request["TaskId"] != null) { taskid = long.Parse(Request["TaskId"]); Data.Notes.Note.RelateTask(model, taskid, currentUser); return(RedirectToAction("Details", "Tasks", new { Id = taskid })); } else if (Request["EventId"] != null) { eventid = Guid.Parse(Request["EventId"]); Data.Notes.Note.RelateEvent(model, eventid, currentUser); return(RedirectToAction("Details", "Events", new { Id = eventid })); } else { throw new HttpRequestValidationException("Must specify a MatterId, TaskId or EventId"); } }
public ActionResult Notes(Guid id) { List <ViewModels.Notes.NoteViewModel> list; list = new List <ViewModels.Notes.NoteViewModel>(); Data.Events.EventNote.ListForEvent(id).ForEach(x => { ViewModels.Notes.NoteViewModel vm = Mapper.Map <ViewModels.Notes.NoteViewModel>(x); list.Add(vm); }); return(View(list)); }