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); }
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); }
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); }
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); }