private static void AddReportToDb(INinjaFactoryData db, JobReport rep)
        {
            Job finishedJob = db.Jobs.Where(j => j.Id == rep.Id).FirstOrDefault();

            finishedJob.IsSuccessfull    = rep.Success;
            finishedJob.EndDate          = rep.EndDate;
            finishedJob.Ninja.KillCount += rep.KillCount;
            db.SaveChanges();
        }
        /// <summary>
        /// Removes the lost ninjas from the data base.
        /// </summary>
        /// <param name="lostNinjas"> The lost ninjas. </param>
        /// <param name="failedMissions"> The failed missions. </param>
        /// <param name="db"> The database. </param>
        private void RemoveFromDataBase(IQueryable <Ninja> lostNinjas, IQueryable <Job> failedMissions, INinjaFactoryData db)
        {
            foreach (Ninja nin in lostNinjas)
            {
                nin.IsDeleted = true;
            }

            foreach (Job job in failedMissions)
            {
                job.IsSuccessfull = false;
                job.EndDate       = DateTime.Now;
            }

            db.SaveChanges();
        }
        /// <summary>
        /// Removes the lost ninjas from the data base.
        /// </summary>
        /// <param name="lostNinjas"> The lost ninjas. </param>
        /// <param name="failedMissions"> The failed missions. </param>
        /// <param name="db"> The database. </param>
        private void RemoveFromDataBase(IQueryable<Ninja> lostNinjas, IQueryable<Job> failedMissions, INinjaFactoryData db)
        {
            foreach (Ninja nin in lostNinjas)
            {
                nin.IsDeleted = true;
            }

            foreach (Job job in failedMissions)
            {
                job.IsSuccessfull = false;
                job.EndDate = DateTime.Now;
            }

            db.SaveChanges();
        }
 private static void AddReportToDb(INinjaFactoryData db, JobReport rep)
 {
     Job finishedJob = db.Jobs.Where(j => j.Id == rep.Id).FirstOrDefault();
     finishedJob.IsSuccessfull = rep.Success;
     finishedJob.EndDate = rep.EndDate;
     finishedJob.Ninja.KillCount += rep.KillCount;
     db.SaveChanges();
 }
 private static void ImportJobToDb(DataBase.Job job, INinjaFactoryData db)
 {
     db.Jobs.Add(job);
     db.SaveChanges();
 }
Пример #6
0
 private static void ImportJobToDb(DataBase.Job job, INinjaFactoryData db)
 {
     db.Jobs.Add(job);
     db.SaveChanges();
 }