Example #1
0
        public HttpResponseMessage AddNotificationToSpesficUser(NotificationForUser userNotification)
        {
            int id = NotificationBL.AddNotification(userNotification.message);

            if (id != -1)
            {
                NotificationBL.AddNotificationForUser(userNotification.userId, id);
                return(Request.CreateResponse(HttpStatusCode.OK, true));
            }
            return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, true));
        }
Example #2
0
 // POST api/<controller>
 public IHttpActionResult Post([FromBody] Notification n)
 {
     try
     {
         NotificationBL.AddNotification(n);
         return(Ok());
     }
     catch
     {
         throw;
     }
 }
 public BaseServiceResult AddNotification(byte[] NotificationContent, byte[] NotificationPreviewContent, IEnumerable <string> oldReceiverIdList)
 {
     try
     {
         using (var notificationBL = new NotificationBL())
         {
             notificationBL.AddNotification(NotificationContent, NotificationPreviewContent, oldReceiverIdList);
             return(new BaseServiceResult(ResultStatusCodes.OK, null));
         }
     } catch (Exception ex)
     {
         Logger.Error("AddNotification", ex);
         return(BaseServiceResult.InternalErrorResult);
     }
 }
Example #4
0
        public HttpResponseMessage SendNotificationForUserNotPay(List <NotificationForUser> userNotification)
        {
            int id = NotificationBL.AddNotification(userNotification[0].message);

            if (id != -1)
            {
                foreach (var t in userNotification)
                {
                    NotificationBL.AddNotificationForUser(t.userId, id);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, true));
            }
            return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, true));
        }
Example #5
0
        public HttpResponseMessage AddNotificationForAllUsers(NotificationForUser userNotification)
        {
            int id = NotificationBL.AddNotification(userNotification.message);

            if (id != -1)
            {
                List <tenant_tbl> tenants = TenantBL.GetAllTenantByBuilding(userNotification.userId);
                foreach (var t in tenants)
                {
                    NotificationBL.AddNotificationForUser(t.user_id, id);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, true));
            }
            return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, true));
        }