Пример #1
0
        public bool Run(CandidateResponseViewModel model, IUnitOfWork unitOfWork, Response <CandidateResponseViewModel> result, ICoreUser CandidateResponse)
        {
            var newCustom = CandidateResponseMapper.MapInsertModelToDbModel(model);

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

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

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

            result.Body = newCustomResult;
            return(true);
        }