public ActionResult Create(string subject, string fullText, string userIDs) { var user = this.CurrentUser(); if (user == null) { return(this.Forbidden("Forbidden", null)); } if (String.IsNullOrWhiteSpace(userIDs) || String.IsNullOrWhiteSpace(subject) || String.IsNullOrWhiteSpace(fullText)) { ViewBag.Warning = Resources.PMCreateWarnings; return(View("Create")); } var ids = userIDs.Split(new[] { ',' }).Select(i => Convert.ToInt32(i)); var users = ids.Select(id => _userService.GetUser(id)).ToList(); _privateMessageService.Create(subject, fullText, user, users); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create(string subject, string fullText, string userIDs) { var user = _userRetrievalShim.GetUser(); if (user == null) { return(StatusCode(403)); } if (string.IsNullOrWhiteSpace(userIDs) || string.IsNullOrWhiteSpace(subject) || string.IsNullOrWhiteSpace(fullText)) { ViewBag.Warning = Resources.PMCreateWarnings; return(View("Create")); } var ids = userIDs.Split(new[] { ',' }).Select(i => Convert.ToInt32(i)); var users = ids.Select(id => _userService.GetUser(id).Result).ToList(); await _privateMessageService.Create(subject, fullText, user, users); return(RedirectToAction("Index")); }