Пример #1
0
        public bool Run(NgTableParams model, ref IQueryable <Database.CandidateSkill> repository, NgTable <CandidateSkillViewModel> result, ICoreUser CandidateSkill, IUnitOfWork db)
        {
            var ngTransformer = new QueryToNgTable <CandidateSkillViewModel>();

            var query = CandidateSkillMapper.MapDbModelQueryToViewModelQuery(repository);

            ngTransformer.ToNgTableDataSet(model, query, result);
            return(true);
        }
Пример #2
0
        public bool Run(CandidateSkillViewModel model, IUnitOfWork unitOfWork, Response <CandidateSkillViewModel> result, ICoreUser CandidateSkill)
        {
            var newCustom = CandidateSkillMapper.MapInsertModelToDbModel(model);

            unitOfWork.With <Database.CandidateSkill>().Add(newCustom);
            unitOfWork.SaveChanges();
            var newCustomResult = CandidateSkillMapper.MapDbModelToViewModel(newCustom);

            result.Body = newCustomResult;
            return(true);
        }
Пример #3
0
        public bool Run(CandidateSkillViewModel model, ref IQueryable <Database.CandidateSkill> repository, IUnitOfWork unitOfWork, Response <CandidateSkillViewModel> result, ICoreUser CandidateSkill)
        {
            var dbModel        = repository.Single(c => c.SkillId == model.SkillId && c.CandidateId == model.CandidateId); // you need to be using the primary key could be composit
            var updatedDbModel = CandidateSkillMapper.MapInsertModelToDbModel(model, dbModel);

            unitOfWork.With <Database.CandidateSkill>().Update(updatedDbModel);
            unitOfWork.SaveChanges();
            var newCustomResult = CandidateSkillMapper.MapDbModelToViewModel(updatedDbModel);

            result.Body = newCustomResult;
            return(true);
        }
Пример #4
0
        public Response <CandidateSkillViewModel> Run(CandidateSkillViewModel model, ref IQueryable <Database.CandidateSkill> repository, IUnitOfWork unitOfWork, Response <CandidateSkillViewModel> result, ICoreUser CandidateSkill)
        {
            var itemToUpdate = repository.SingleOrDefault(c => c.SkillId == model.SkillId && c.CandidateId == model.CandidateId);

            if (itemToUpdate != null)
            {
                var newCustomResult = CandidateSkillMapper.MapDbModelToViewModel(itemToUpdate);
                result.Body    = newCustomResult;
                result.Success = true;
            }
            else
            {
                result.Success = false;
                result.LogError("Error viewing CandidateSkills");
            }

            return(result);
        }