コード例 #1
0
 public ActionResult Send(string key, string subject="")
 {
     var to = _profileService.GetProfile(key);
     var model = new ConversationModel {
         ToId = to.Id, ToName = to.Name, ToPhotoGuid = to.ProfilePhotoGuid, ToGuid = to.Guid,
         FromId = KatushaProfile.Id, FromName = KatushaProfile.Name, FromPhotoGuid = KatushaProfile.ProfilePhotoGuid, FromGuid = KatushaProfile.Guid
     };
     return ContextDependentView(model, "Send");
     //return View(model);
 }
コード例 #2
0
        private ActionResult _Send(string key, ConversationModel model, ActionResult successResult, ActionResult failResult)
        {
            if (!ModelState.IsValid) return failResult;
            var to = _profileService.GetProfile(key);
            var data = Mapper.Map<Conversation>(model);

            data.ToId = to.Id;
            data.ToName = to.Name;
            data.ToGuid = to.Guid;
            data.ToPhotoGuid = to.ProfilePhotoGuid;

            data.FromId = KatushaProfile.Id;
            data.FromName = KatushaProfile.Name;
            data.FromGuid = KatushaProfile.Guid;
            data.FromPhotoGuid = KatushaProfile.ProfilePhotoGuid;

            data.ReadDate = new DateTime(1900, 1, 1);
            _conversationService.SendMessage(KatushaUser, data);
            return successResult;
        }
コード例 #3
0
 public ActionResult Send(string key, ConversationModel model)
 {
     return IsBlocked() ? RedirectToAction("Index", "Home") : _Send(key, model, RedirectToAction("Received"), View(model));
 }
コード例 #4
0
 public JsonResult JsonSend(string key, ConversationModel model)
 {
     if (IsBlocked()) return Json(new {errors = (IEnumerable<string>) new[] {"Try again!"}});
     return (JsonResult) _Send(key, model, Json(new { success = true, message = "Your message has been sent." }), Json(new { errors = GetErrorsFromModelState() }));
 }