public static string NoteControl(this HtmlHelper helper, NoteType type, string key, string title, bool isReadOnly = false) { var model = new NoteControlViewModel { Type = type, Key = key, IsReadOnly = isReadOnly }; var identity = helper.ViewContext.HttpContext.User.Identity; var factory = new ServiceFactory(MvcApplication.ConnectionString, identity); var user = factory.GetById <IUserDto>(identity.GetUserId()); model.User = user.DisplayName; if (!string.IsNullOrEmpty(title)) { model.Title = title; } helper.RenderPartial("_NoteControl", model); return(null); }
public NoteControl(Note note) { InitializeComponent(); ViewModel = new NoteControlViewModel(); ViewModel.Note = note; this.DataContext = ViewModel; }
public ActionResult NoteControl(NoteType type, string key, string title) { var model = new NoteControlViewModel { Type = type, Key = key }; if (!string.IsNullOrEmpty(title)) { model.Title = title; } var user = Factory.GetById <IUserDto>(User.Identity.GetUserId()); model.User = user.DisplayName; return(PartialView("_NoteControl", model)); }