示例#1
0
        public bool Run(EmployerResponseViewModel model, IUnitOfWork unitOfWork, Response <EmployerResponseViewModel> result, ICoreUser EmployerResponse)
        {
            var newCustom = EmployerResponseMapper.MapInsertModelToDbModel(model);

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

            result.Body = newCustomResult;
            return(true);
        }
示例#2
0
        public bool Run(EmployerResponseViewModel model, ref IQueryable <Database.EmployerResponse> repository, IUnitOfWork unitOfWork, Response <EmployerResponseViewModel> result, ICoreUser EmployerResponse)
        {
            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 = EmployerResponseMapper.MapInsertModelToDbModel(model, dbModel);

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

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