public void Init()
 {
     this.sanitizeService = new HtmlSanitizerAdapter();
     this.messageService = ObjectFactory.GetMessageService();
     this.userService = ObjectFactory.GetUserService();
     this.controller = new MessageController(this.userService, this.messageService, this.sanitizeService);
     this.model = new MessageSaveViewModel
     {
         ToUserName = "******",
         ToUserId = "123456"
     };
     this.controller.CurrentUser = this.userService.GetUser("test");
 }
Example #2
0
 public void Init()
 {
     this.sanitizeService = new HtmlSanitizerAdapter();
     this.messageService  = ObjectFactory.GetMessageService();
     this.userService     = ObjectFactory.GetUserService();
     this.controller      = new MessageController(this.userService, this.messageService, this.sanitizeService);
     this.model           = new MessageSaveViewModel
     {
         ToUserName = "******",
         ToUserId   = "123456"
     };
     this.controller.CurrentUser = this.userService.GetUser("test");
 }
        public ActionResult Create(MessageSaveViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                model.Content = this.sanitizeService.Sanitize(model.Content);

                var newMessage = AutoMapper.Mapper.Map<Message>(model);

                newMessage.FromUserId = this.CurrentUser.Id;

                var result = this.messageService.AddMessage(newMessage);

                return this.RedirectToAction("Index", "User", new { area = "Private"});
            }

            return this.View(model);
        }
        public ActionResult Create(MessageSaveViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                model.Content = this.sanitizeService.Sanitize(model.Content);

                var newMessage = AutoMapper.Mapper.Map <Message>(model);

                newMessage.FromUserId = this.CurrentUser.Id;

                var result = this.messageService.AddMessage(newMessage);

                return(this.RedirectToAction("Index", "User", new { area = "Private" }));
            }

            return(this.View(model));
        }
 public ActionResult Send(MessageSaveViewModel model)
 {
     return View(model);
 }
 public ActionResult Send(MessageSaveViewModel model)
 {
     return(View(model));
 }