public void Create(DalTest e) { if (e == null) { return; } var test = e.ToTest(); context.Set <Test>().Add(test); }
public void Update(DalTest entity) { if (entity == null) { return; } var test = context.Set <Test>().SingleOrDefault(t => t.Id == entity.Id); if (test == default(Test)) { test = entity.ToTest(); context.Set <Test>().Add(test); return; } test.Name = entity.Name; test.Number = entity.Number; test.TimeToDo = entity.TimeToDo; context.Entry(test).State = EntityState.Modified; }
/// <summary> /// Removes test from data storage. /// </summary> /// <param name="test"> Test to remove.</param> /// <exception> System.ArgumentNullException if test is null.</exception> public void Delete(DalTest test) => repository.Delete(test?.ToTest());
/// <summary> /// Adds new test to data storage. /// </summary> /// <param name="test"> Test to add.</param> /// <exception> System.ArgumentNullException if test is null.</exception> public void Create(DalTest test) => repository.Create(test?.ToTest());