Example #1
0
 public static async Task <ICollection <Tag> > GetTags(long id)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var pictureRepo = new Data.Repositories.PictureRepository(ctx, null);
             return(await pictureRepo.GetTags(id));
         }
     }
     catch
     {
         return(new List <Tag>());
     }
 }
Example #2
0
 public static Core.Models.UserFollower Find(long userId, long followerId)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             return(UserFollowerRepo.Find(userId, followerId));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #3
0
 public static async Task <List <Core.Models.Picture> > GetAll(string include)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var pictureRepo = new Data.Repositories.PictureRepository(ctx, null);
             return(await pictureRepo.GetAll(include));
         }
     }
     catch
     {
         return(new List <Core.Models.Picture>());
     }
 }
Example #4
0
 public static async Task <Core.Models.Like> Get(long id, string include)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var LikeRepo = new Data.Repositories.LikeRepository(ctx, null);
             return(await LikeRepo.Get(id, include));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #5
0
 public static async Task <List <Core.Models.UserFollower> > GetAll(IEnumerable <string> includes)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             return(await UserFollowerRepo.GetAll(includes));
         }
     }
     catch
     {
         return(new List <Core.Models.UserFollower>());
     }
 }
Example #6
0
 public static Core.Models.Like Find(long userId, long pictureId)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var LikeRepo = new Data.Repositories.LikeRepository(ctx, null);
             return(LikeRepo.Find(userId, pictureId));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #7
0
 public static async Task <List <Core.Models.Like> > GetAll()
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var LikeRepo = new Data.Repositories.LikeRepository(ctx, null);
             return(await LikeRepo.GetAll());
         }
     }
     catch
     {
         return(new List <Core.Models.Like>());
     }
 }
Example #8
0
 public static async Task <Core.Models.User> GetUser(long id)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             return(await UserFollowerRepo.GetUser(id));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #9
0
 public static async Task <Core.Models.Comment> Get(long id, IEnumerable <string> includes)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             return(await commentRepo.Get(id, includes));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #10
0
 public static async Task <Core.Models.Picture> GetPicture(long id)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             return(await commentRepo.GetPicture(id));
         }
     }
     catch
     {
         return(null);
     }
 }
Example #11
0
 public static bool Update(Core.Models.Picture entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var pictureRepo = new Data.Repositories.PictureRepository(ctx, null);
             pictureRepo.Update(entity);
             return(pictureRepo.SaveChanges());
         }
     }
     catch
     {
         return(false);
     }
 }
Example #12
0
 public static bool Delete(Core.Models.UserFollower entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             UserFollowerRepo.Delete(entity);
             return(UserFollowerRepo.SaveChanges());
         }
     }
     catch
     {
         return(false);
     }
 }
Example #13
0
 public static bool AddRange(IEnumerable <Core.Models.UserFollower> entities)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             UserFollowerRepo.AddRange(entities);
             return(UserFollowerRepo.SaveChanges());
         }
     }
     catch
     {
         return(false);
     }
 }
Example #14
0
        public static async Task <List <Core.Models.User> > GetAll(string include)
        {
            try
            {
                using (var ctx = new Data.AmstramgramContext())
                {
                    var userRepo = new Data.Repositories.UserRepository(ctx, null);
                    var result   = await userRepo.GetAll(include);

                    return(result);
                }
            }
            catch
            {
                return(new List <Core.Models.User>());
            }
        }
Example #15
0
        public static async Task <Core.Models.User> Get(long id)
        {
            try
            {
                using (var ctx = new Data.AmstramgramContext())
                {
                    var userRepo = new Data.Repositories.UserRepository(ctx, null);
                    var result   = await userRepo.Get(id);

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Example #16
0
        public static async Task <Core.Models.UserFollower> Get(long id, IEnumerable <string> includes)
        {
            try
            {
                using (var ctx = new Data.AmstramgramContext())
                {
                    var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
                    var result           = await UserFollowerRepo.Get(id, includes);

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Example #17
0
        public static async Task <Core.Models.Picture> Get(long id, string include)
        {
            try
            {
                using (var ctx = new Data.AmstramgramContext())
                {
                    var pictureRepo = new Data.Repositories.PictureRepository(ctx, null);
                    var result      = await pictureRepo.Get(id, include);

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Example #18
0
        public static async Task <ICollection <Core.Models.Picture> > GetPictures(long id)
        {
            try
            {
                using (var ctx = new Data.AmstramgramContext())
                {
                    var userRepo = new Data.Repositories.UserRepository(ctx, null);
                    var result   = await userRepo.GetPictures(id);

                    return(result);
                }
            }
            catch
            {
                return(new List <Core.Models.Picture>());
            }
        }
Example #19
0
 public static Core.Models.Picture Add(Core.Models.Picture entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var pictureRepo = new Data.Repositories.PictureRepository(ctx, null);
             var result      = pictureRepo.Add(entity);
             if (!pictureRepo.SaveChanges())
             {
                 return(null);
             }
             return(result);
         }
     }
     catch
     {
         return(null);
     }
 }
Example #20
0
 public static Core.Models.UserFollower Add(Core.Models.UserFollower entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var UserFollowerRepo = new Data.Repositories.UserFollowerRepository(ctx, null);
             var result           = UserFollowerRepo.Add(entity);
             if (!UserFollowerRepo.SaveChanges())
             {
                 return(null);
             }
             return(result);
         }
     }
     catch
     {
         return(null);
     }
 }