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); } }
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); } }
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>()); } }
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); } }
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); } }
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); } }