public ActionResult Send(SendNotificationModel model, string returnUrl) { if (ModelState.IsValid) return TrySend(model, returnUrl); return View(model); }
public ActionResult Send(Guid id, string returnUrl) { var model = new SendNotificationModel() { UserId = id, }; return View(model); }
private ActionResult TrySend(SendNotificationModel model, string returnUrl) { try { var notification = CreateNotification(model.Message, model.UserId, model.Type); this.Service.SendNotification(this.SecurityToken, notification); } catch (ForbiddenException) { AddModelStateError(GlobalStrings.Forbidden); return View(model); } catch (Exception) { AddModelStateError(GlobalStrings.SomethingWentWrong); return View(model); } string id = Session[ArbConstants.SessionCurrentCaseKey].ToString(); return RedirectToLocal(returnUrl, Convert.ToInt32(id)); }
// public void NotifyCaseWorker(int Id) public ActionResult NotifyCaseWorker(int Id, string Message) { int caseid = Id; List<User> lstuser = this.Service.GetCaseWorkerforaCase(this.SecurityToken, caseid); foreach (var lst in lstuser) { if (lstuser.Count == 1) { SendNotificationModel notObject = new SendNotificationModel(); notObject.Message = Message; notObject.UserId = lst.Id; notObject.Type = CreateNotificationBase.DeliveryType.Both; TrySend(notObject, "Comments"); } } return RedirectToLocal("Comments", caseid); }