コード例 #1
0
        public Task <TaskType> CreateAsync(TaskType domainEntity)
        {
            var @new = TaskType.Create(domainEntity.Name, domainEntity.Cost, domainEntity.Duration, this.lastId + 1);

            Db.Add(@new);

            return(Task.FromResult(@new));
        }
コード例 #2
0
ファイル: FakerFactory.cs プロジェクト: rgoncalves95/taskerAI
        public static TaskType CreateTaskType()
        {
            Faker <TaskType> taskTypeFaker = new Faker <TaskType>()
                                             .CustomInstantiator(f => TaskType.Create(
                                                                     f.Lorem.Sentence(2),
                                                                     f.Random.Double(60, 120),
                                                                     f.Random.Int(1200, 3600),
                                                                     null));

            return(taskTypeFaker.Generate());
        }
コード例 #3
0
 internal Domain.Entities.Task AsDomainEntity()
 {
     return(Domain.Entities.Task.Create
            (
                this.Name,
                TaskType.Create(this.TypeId),
                Domain.Entities.Location.Create(this.Street, this.Door, this.Floor, this.ZipCode, this.City, this.Country, this.Latitude, this.Longitude, this.Alias, this.Tags),
                this.Date,
                this.DueDate,
                this.DurationInSeconds,
                this.Notes
            ));
 }
コード例 #4
0
 public static IEnumerable <TaskType> DatabaseSeed()
 {
     return(new[]
     {
         TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
         TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
         TaskType.Create("Cleaning 3BR apt.", 20.0, 6000, 3),
         TaskType.Create("Cleaning 4BR apt.", 25.0, 7200, 4),
         TaskType.Create("Cleaning 5BR apt.", 30.0, 8400, 5),
         TaskType.Create("delivery", 20.0, 600, 6),
         TaskType.Create("Check in", 10.0, 1200, 7),
         TaskType.Create("Start", 0.0, 0, 8),
         TaskType.Create("Maintenance", 0.0, 3600, 9)
     });
 }
コード例 #5
0
ファイル: TaskMockData.cs プロジェクト: rgoncalves95/taskerAI
        public static IEnumerable <Task> DatabaseSeed()
        {
            var result = new List <Task>();
            int id     = 1;

            result.Add(Task.Create
                       (
                           "Clean Apt 1",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[0],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(1),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 2",
                           TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
                           LocationRepository.Db[1],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(5),
                           4800,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 3",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[2],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(3),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 4",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[3],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(3),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 5",
                           TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
                           LocationRepository.Db[4],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(8),
                           4800,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 6",
                           TaskType.Create("Cleaning 3BR apt.", 20.0, 6000, 3),
                           LocationRepository.Db[5],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(4),
                           6000,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 7",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[6],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(9),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 8",
                           TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
                           LocationRepository.Db[7],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(2),
                           4800,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 9",
                           TaskType.Create("Cleaning 3BR apt.", 20.0, 6000, 3),
                           LocationRepository.Db[8],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(2),
                           6000,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 10",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[9],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(6),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 11",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[10],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(4),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));


            result.Add(Task.Create
                       (
                           "Clean Apt 12",
                           TaskType.Create("Cleaning 1BR apt.", 10.0, 3600, 1),
                           LocationRepository.Db[11],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(4),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 13",
                           TaskType.Create("Cleaning 3BR apt.", 20.0, 6000, 3),
                           LocationRepository.Db[12],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(6),
                           6000,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Clean Apt 14",
                           TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
                           LocationRepository.Db[13],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(7),
                           4800,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));


            result.Add(Task.Create
                       (
                           "Clean Apt 15",
                           TaskType.Create("Cleaning 2BR apt.", 15.0, 4800, 2),
                           LocationRepository.Db[14],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(2),
                           4800,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Check in Apt 8",
                           TaskType.Create("Check in", 10.0, 1200, 7),
                           LocationRepository.Db[15],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(2),
                           1200,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Check in Apt 9",
                           TaskType.Create("Check in", 10.0, 1200, 7),
                           LocationRepository.Db[16],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(2),
                           1200,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Check in Apt 10",
                           TaskType.Create("Check in", 10.0, 1200, 7),
                           LocationRepository.Db[17],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(6),
                           1200,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Check in Apt 11",
                           TaskType.Create("Check in", 10.0, 1200, 7),
                           LocationRepository.Db[18],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(4),
                           1200,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            result.Add(Task.Create
                       (
                           "Maintenance Apt 7",
                           TaskType.Create("Maintenance", 0.0, 3600, 9),
                           LocationRepository.Db[19],
                           DateTimeOffset.Now,
                           DateTimeOffset.Now.AddHours(3),
                           3600,
                           "some notes that we take",
                           TaskStatus.Draft,
                           null,
                           id++
                       ));

            return(result);
        }