public ActionResult SendMessage(long id, FormCollection fc) { string strMessage = fc["Message"]; try { Guid userid = _repoUserProfile.GetSingle(x => x.Id == id).UserId; EmailSender.SendMail(Membership.GetUser(userid).Email, "Leonni Private Message", strMessage); MessageModel objMessage = new MessageModel(); objMessage.SentDate = DateTime.Now; objMessage.SentBy = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId).Id; objMessage.MessageContent = strMessage; objMessage.SentTo = id; _repoMessage.Add(MessageMap.Map(objMessage)); _repoMessage.Save(); return(Json(new { status = "success", Message = "Message sent" })); } catch (Exception e) { return(Json(new { status = "error", Message = "Unable to send Message" })); } }
protected void MapMessage <TMessage, TAdapter>() where TMessage : IMessage where TAdapter : IProtocolAdapter { MessageMap.Map <TMessage>(ServiceLocator.GetInstance <TAdapter>()); }