private void SeedTasks() { using (var context = new TorshiaContext()) { var affectedSector = context.SectorTypes.FirstOrDefault(s => s.Name == "Customers"); for (int i = 0; i < 5; i++) { Random rand = new Random(); int randomSectors = rand.Next(1, context.SectorTypes.Count()); context.Tasks.Add(new Task() { Title = $"GeneratedTitle {new string(char.Parse(i.ToString()), 5)}", DueDate = DateTime.ParseExact("01-12-2018", "dd-MM-yyyy", CultureInfo.InstalledUICulture), IsReported = false, Participants = "Pesho, Gosho, User", Description = $"{new string('A', 10)}", AffectedSectors = $"{randomSectors}", }); } context.SaveChanges(); } }
public override void Configure() { using (var context = new TorshiaContext()) { if (!context.Users.Any()) { Console.WriteLine("SEEDING DATABASE"); SeedDatabase(); } if (!context.Tasks.Any()) { SeedTasks(); } } }
public static void Main() { var context = new TorshiaContext(); for (int i = 0; i < 6; i++) { context.Reports.Add(new Report { Status = Status.Completed, TaskId = 2, ReporterId = 1, ReportedOn = DateTime.Now }); } context.SaveChanges(); WebHost.Start(new StartUp()); }
static void Main(string[] args) { var context = new TorshiaContext(); //for (int i = 1; i < 8; i++) //{ // context.Tasks.Add(new Task // { // Title = $"StarWars Episode:{i}", // Description = $"Bad rating {i}/10", // DueDate = DateTime.Now, // Participants = "J. Lucfuk u dumb ass sellout bi4 nigg" // }); //} //context.SaveChanges(); WebHost.Start(new StartUp()); }
private void SeedDatabase() { using (var context = new TorshiaContext()) { context.UserRoles.Add(new UserRole { Name = "User" }); context.UserRoles.Add(new UserRole { Name = "Admin" }); context.SectorTypes.Add(new SectorType { Name = "Customers" }); context.SectorTypes.Add(new SectorType { Name = "Marketing" }); context.SectorTypes.Add(new SectorType { Name = "Finances" }); context.SectorTypes.Add(new SectorType { Name = "Internal" }); context.SectorTypes.Add(new SectorType { Name = "Management" }); context.ReportStatuses.Add(new ReportStatus { Name = "Completed" }); context.ReportStatuses.Add(new ReportStatus { Name = "Archived" }); context.SaveChanges(); } }
private static void SeedTasks() { var db = new TorshiaContext(); for (int i = 1; i <= 10; i++) { db.Tasks.Add(new Task { Title = $"Fix Business Agenda{i}", DueDate = new System.DateTime(2019 + i, 09, 11 + i), Description = $"The business agaenda of the company needs to be rethought.{i}", Participants = $"Todor Ivanov{i}, Jordan Draganov{i}, Dimitar Stefanov{i}", AffectedSectors = new List <TaskSector>() { new TaskSector() { Sector = Sector.Management }, new TaskSector() { Sector = Sector.Finances }, new TaskSector() { Sector = Sector.Management }, new TaskSector() { Sector = Sector.Internal } } }); } db.SaveChanges(); }
public TasksService(TorshiaContext context) { this.context = context; }
public ReportsService(TorshiaContext context) { this.context = context; }
public BaseController() { this.db = new TorshiaContext(); }
public TasksService(TorshiaContext context) : base(context) { }
public UsersService(TorshiaContext context) : base(context) { }
public TaskService(TorshiaContext context) { db = context; }
public ReportService(TorshiaContext db, ITaskService taskService) { this.db = db; this.taskService = taskService; }
protected BaseController() { this.db = new TorshiaContext(); }
public UserService(TorshiaContext db) { this.db = db; }
public BaseService(TorshiaContext context) { this.context = context; }
public UserService(TorshiaContext context) { db = context; }
public UsersServices(TorshiaContext context) { this.context = context; }
public TaskService(TorshiaContext db) { this.db = db; }
public ReportService(TorshiaContext context) { db = context; }
public ReportService(TorshiaContext context, ITasksService tasksService) : base(context) { this.taskService = tasksService; }
protected BaseService(TorshiaContext context) { this.context = context; }