public void UpdateType(int id, string name) { Enitities.Type type = takaDB.Types.Where(x => x.ID == id).First(); if (type == null) { return; } type.Name = name; takaDB.SaveChanges(); }
public void AddType(string name) { if (takaDB.Types.Where(e => e.Name.Equals(name)).Count() > 0) { return; } Enitities.Type author = new Enitities.Type(); author.Name = name; takaDB.Types.Add(author); takaDB.SaveChanges(); }
public void RemoveType(int id) { try { Enitities.Type author = takaDB.Types.Where(x => x.ID == id).First(); takaDB.Types.Remove(author); takaDB.SaveChanges(); } catch (Exception) { } }