Пример #1
0
 public void Remove(CareerPathJobs CareerPJobs)
 {
     if (Context.Entry(CareerPJobs).State == EntityState.Detached)
     {
         context.CareerPathJobs.Attach(CareerPJobs);
     }
     context.CareerPathJobs.Remove(CareerPJobs);
 }
Пример #2
0
        public ActionResult CreateCareerPathJobs(IEnumerable <CareerPathJobsViewModel> models, OptionsViewModel moreInfo)
        {
            var result     = new List <CareerPathJobs>();
            var datasource = new DataSource <CareerPathJobsViewModel>();

            if (ModelState.IsValid)
            {
                foreach (CareerPathJobsViewModel c in models)
                {
                    var PathJobs = new CareerPathJobs();

                    AutoMapper(new Models.AutoMapperParm
                    {
                        Destination = PathJobs,
                        Source      = c,
                        ObjectName  = "CareerPathJobs",
                        Options     = moreInfo,
                        Transtype   = TransType.Insert
                    });
                    result.Add(PathJobs);
                    _hrUnitOfWork.JobRepository.Add(PathJobs);
                }
                datasource.Errors = SaveChanges(Language);
            }

            else
            {
                datasource.Errors = Models.Utils.ParseErrors(ModelState.Values);
            }

            datasource.Data = (from model in models
                               join r in result on model.CareerId equals r.CareerId
                               select new CareerPathJobsViewModel
            {
                Id = r.Id,
                FormulaId = model.FormulaId,
                Performance = model.Performance,
                MinYears = model.MinYears,
                JobName = model.JobName,
                JobId = model.JobId,
                Sequence = model.Sequence
            }).ToList();


            if (datasource.Errors.Count() > 0)
            {
                datasource.Data = models;
                return(Json(datasource));
            }
            else
            {
                return(Json(datasource.Data));
            }
        }
Пример #3
0
 public DbEntityEntry <CareerPathJobs> Entry(CareerPathJobs CareerPjob)
 {
     return(Context.Entry(CareerPjob));
 }
Пример #4
0
 public void Attach(CareerPathJobs CareerPJobs)
 {
     context.CareerPathJobs.Attach(CareerPJobs);
 }
Пример #5
0
 public void Add(CareerPathJobs CareerPJobs)
 {
     context.CareerPathJobs.Add(CareerPJobs);
 }