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); }
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; }
public ActionResult Send(string key, ConversationModel model) { return IsBlocked() ? RedirectToAction("Index", "Home") : _Send(key, model, RedirectToAction("Received"), View(model)); }
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() })); }