Exemplo n.º 1
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);
     }
 }
Exemplo n.º 2
0
 public static async Task <Core.Models.User> GetUser(long id)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             return(await commentRepo.GetUser(id));
         }
     }
     catch
     {
         return(null);
     }
 }
Exemplo n.º 3
0
 public static async Task <List <Core.Models.Comment> > GetAll(string include)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             return(await commentRepo.GetAll(include));
         }
     }
     catch
     {
         return(new List <Core.Models.Comment>());
     }
 }
Exemplo n.º 4
0
 public static bool Delete(Core.Models.Comment entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             commentRepo.Delete(entity);
             return(commentRepo.SaveChanges());
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 5
0
 public static bool AddRange(IEnumerable <Core.Models.Comment> entities)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             commentRepo.AddRange(entities);
             return(commentRepo.SaveChanges());
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 6
0
 public static Core.Models.Comment Add(Core.Models.Comment entity)
 {
     try
     {
         using (var ctx = new Data.AmstramgramContext())
         {
             var commentRepo = new Data.Repositories.CommentRepository(ctx, null);
             var result      = commentRepo.Add(entity);
             if (!commentRepo.SaveChanges())
             {
                 return(null);
             }
             return(result);
         }
     }
     catch
     {
         return(null);
     }
 }