public Laboratory add(Laboratory acc) { try { _context.Laboratories.Add(acc); _context.SaveChanges(); Logger.Log(acc.Laboratory1 + " is Added", LogType.Info); } catch (Exception e) { Logger.Log(e.ToString(), LogType.Error); } return(acc); }
public Laboratory delete(Laboratory acc) { try { _context.Entry(acc).State = System.Data.Entity.EntityState.Deleted; _context.SaveChanges(); Logger.Log(acc.Laboratory1 + " is Deleted", LogType.Info); } catch (Exception e) { Logger.Log(e.ToString(), LogType.Error); } return(acc); }
public Laboratory getByName(string name) { Laboratory acc = _context.Laboratories.FirstOrDefault(o => o.Laboratory1 == name); return(acc); }