public List <ModelViewNotification> GetByToken(EntitySecurity model)
        {
            if (model.TokenApp != GlobalConfiguration.TokenWEB)
            {
                if (model.TokenApp != GlobalConfiguration.TokenMobile)
                {
                    throw new Exception("TokenInvalid");
                }
            }

            var dataUser = new BusinessUsers().GetUserByToken(model.TokenUser);

            TimeZoneInfo estZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time (Mexico)");

            return(new RepositoryNotification().GetByUserID(dataUser.UserID).Select(p => new ModelViewNotification()
            {
                MessageID = p.MessageID,
                Message = p.Message,
                MessageRead = p.MessageRead,
                Title = p.Title,
                Url = p.Url,
                UserID = p.UserID,
                UserName = p.UserName,
                Status = p.Status,
                CreateDate = TimeZoneInfo.ConvertTimeFromUtc(p.CreateDate, estZone),
                ModifyDate = TimeZoneInfo.ConvertTimeFromUtc(p.ModifyDate, estZone),
                CreateDateString = TimeZoneInfo.ConvertTimeFromUtc(p.CreateDate, estZone).ToString("dd/MM/yyyy HH:mm:ss"),
                ModifyDateString = TimeZoneInfo.ConvertTimeFromUtc(p.ModifyDate, estZone).ToString("dd/MM/yyyy HH:mm:ss")
            }).ToList());
        }
Exemple #2
0
 public static List <ModelViewNotification> GetByToken(EntitySecurity TokenUser)
 {
     return(new BusinessNotification().GetByToken(TokenUser));
 }