public Enum.EntityResult Delete(Album delete) { try { _db.Albums.Remove(delete); _db.SaveChanges(); return Enum.EntityResult.Success; } catch (Exception) { return Enum.EntityResult.Failed; } }
public Enum.EntityResult Create(Album album) { try { album.Active = true; _db.Albums.Add(album); _db.SaveChanges(); return Enum.EntityResult.Success; } catch (Exception) { return Enum.EntityResult.Failed; } }
public Enum.EntityResult Update(Album modified) { try { _db.Entry(modified).State = EntityState.Modified; _db.SaveChanges(); return Enum.EntityResult.Success; } #pragma warning disable CS0168 // Variable is declared but never used catch (Exception r) #pragma warning restore CS0168 // Variable is declared but never used { return Enum.EntityResult.Failed; } }
public int _galleryCreate(Album model) { if (!ModelState.IsValid) { this.AddToastMessage("", "Alanları kontrol Ediniz", Enum.ToastrType.Warning); return 0; } model.AuthorId = new AuthenticatedAuthor().Id; var res = new AlbumRepository().Create(model); if (res == Enum.EntityResult.Failed) { this.AddToastMessage("", "Album oluşturulurken hata", Enum.ToastrType.Error); return 0; } this.AddToastMessage("", "Kayıt Başarılı", Enum.ToastrType.Success); return model.Id; }
public Enum.EntityResult Disable(Album disable) { disable.Active = false; return Update(disable); }