public static IList<User> GetUsers() { if (Users == null) { // should be injected var repository = new TimekeepRepository(); Users = repository.GetUsers().ToList(); } return Users; }
/// <summary> /// Get an Event from the DTO /// </summary> /// <returns>an Event object for EF</returns> public Event GetEvent() { var repository = new TimekeepRepository(); return new Event { Id = this.Id, User = repository.GetUser(this.UserId), Date = DateTime.Parse(this.Date), Hours = this.Hours, Client = this.Client, Category = repository.GetCategories().First(c => c.Name == this.Category || c.Id == this.CategoryId), CurrentStatus = (StatusEnum)this.CurrentStatusId, Description = this.Description }; }
public TimekeepController() { this.repository = new TimekeepRepository(); }
public TimekeepController(TimekeepRepository repository) { this.repository = repository; }