예제 #1
0
        // GET: Job/Create
        public ActionResult Create()
        {
            var repo = new JobRepository();
            var job  = repo.CreateJob();

            return(View(job));
        }
예제 #2
0
        private async Task <bool> generateFakeJobs()
        {
            string[] titlesP1 = new string[] { "Walking", "Cleaning", "Showing", "Taking care of", "Moving", "Exercising with", "Talking to", "Entertaining", "Joking with", "Brushing", "Watching after", };
            string[] titlesP2 = new string[] { "cats", "dogs", "old people", "birds", "Donald Trump", "Michael Jordan", "Cristiano Ronaldo", "Lionel Messi", "Pope Francis", "Rocky Balboa", "John Rambo", };

            var randomNumber = new Random();

            for (var i = 0; i < 40; i++)
            {
                var titleP1Random = randomNumber.Next(titlesP1.Length - 1);
                var titleP2Random = randomNumber.Next(titlesP2.Length - 1);
                var createdBy     = randomNumber.Next(1, 12);
                var hours         = randomNumber.Next(1, 100);
                var categoryId    = randomNumber.Next(1, 4);
                var price         = randomNumber.Next(100, 10000);

                //55.694478, 12.550819 KEA ORIGINAL
                // 55.706468, 12.539151 KEA LYNGTEN 16
                //  LAT, LONG
                var keaGeoLatitude  = i % 2 == 0 ? "55.694478" : "55.706468";
                var keaGeoLongitude = i % 2 == 0 ? "12.550819" : "12.539151";

                var job = new Job()
                {
                    Title       = titlesP1[titleP1Random] + " " + titlesP2[titleP2Random],
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. ",
                    CreatedBy   = createdBy,
                    Hours       = hours,
                    CategoryID  = categoryId,
                    DateStart   = DateTime.Now.AddDays(20 + i),
                    DateEnd     = DateTime.Now.AddDays(22 + i),
                    Price       = price,
                    Status      = "PENDING",
                    Latitude    = keaGeoLatitude,
                    Longitude   = keaGeoLongitude,
                };

                await _repo.CreateJob(job);
            }
            ;

            return(true);
        }
 /// <summary>
 /// Create new Job with the total updates that contained
 /// </summary>
 /// <param name="totalUpdates"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public async Task <Guid> CreateNewJob(int totalUpdates, CancellationToken cancellationToken) =>
 (await _jobRepository.CreateJob(new Job()
 {
     HasFinished = false, CompletedUpdates = 0, TotalUpdates = totalUpdates, FailedUpdates = 0
 }, cancellationToken)).JobId;