Example #1
0
        public HttpResponseMessage UpdateReaded([FromBody] UpdateReadedRequest request)
        {
            var model  = new NotificationModel();
            var result = model.UpdateReaded(request.NotificationId);

            if (result)
            {
                var response = new UpdateReadedResponse();
                response.PersonId     = request.PersonId;
                response.NumberUnread = model.GetNumberUnread(request.PersonId);
                return(ResponseSuccess(StringResource.Success, response));
            }
            return(ResponseFail(StringResource.Sorry_an_error_has_occurred));
        }
Example #2
0
        public HttpResponseMessage ListNotification([FromBody] ListNotificationRequest request)
        {
            var model        = new NotificationModel();
            var list         = model.ListNotificationByPersonId(request.PersonId, request.Page, request.PageSize);
            var listResponse = new List <NotificationResponse>();

            foreach (var item in list)
            {
                var notificationResponse = new NotificationResponse();
                notificationResponse.NotificationId = item.NOTIFICATION_ID;
                notificationResponse.Title          = item.TITLE;
                notificationResponse.Message        = item.MESSAGE;
                notificationResponse.Image          = item.IMAGE;
                notificationResponse.PersonIdFrom   = item.PERSON_ID_FROM;
                notificationResponse.PersonIdTo     = item.PERSON_ID_TO;
                notificationResponse.Readed         = item.READED.Value;
                notificationResponse.CreateDate     = item.CREATE_DATE.Value;
                notificationResponse.NumberUnread   = model.GetNumberUnread(item.PERSON_ID_TO);
                listResponse.Add(notificationResponse);
            }
            return(ResponseSuccess(StringResource.Success, listResponse));
        }