public static bool Delete(Core.Models.Picture entity) { try { using (var ctx = new Data.AmstramgramContext()) { var pictureRepo = new Data.Repositories.PictureRepository(ctx, null); pictureRepo.Delete(entity); return(pictureRepo.SaveChanges()); } } catch { return(false); } }
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); } }