public IList <CompletedObjectiveDTO> GetAllCompletedObjectives() { using (var context = new ObjectiveContext()) { return(_mapper.Map <IList <CompletedObjectiveDTO> >(context.CompletedObjectives.ToList())); } }
public IList <CategoryDTO> GetAllCategories() { using (var context = new ObjectiveContext()) { return(_mapper.Map <IList <CategoryDTO> >(context.Categories.ToList())); } }
public void CompleteObjectiveById(int id) { using (var context = new ObjectiveContext()) { var objective = context.Objectives.FirstOrDefault(obj => obj.Id == id); objective.IsCompleted = true; context.SaveChanges(); //SQL Trigger (it works, I checked): //CREATE TRIGGER Objective_Complete //ON Objectives //AFTER UPDATE //AS //INSERT INTO CompletedObjectives //SELECT i.Id, GETDATE() //FROM Objectives o //INNER JOIN INSERTED i on o.Id = i.id //AND i.IsCompleted = 1 } }
public ObjectiveRepository(ObjectiveContext context) { this.db = context; }
public ObjectiveRepository(ObjectiveContext context) { _context = context; }
public EFUnitOfWork(DbContextOptions <ObjectiveContext> options) { db = new ObjectiveContext(options); }
public ObjectiveController(ObjectiveContext _db) { db = _db; }