コード例 #1
0
ファイル: CarTypeService.cs プロジェクト: codedive/MyDemo1
 public CarTypeModel SaveCarType(CarTypeModel model)
 {
     //unitOfWork.StartTransaction();
     CarTypeRepository repo = new CarTypeRepository(unitOfWork);
     CarType carType = new CarType();
     AutoMapper.Mapper.Map(model, carType);
     repo.Insert(carType);
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(carType, model);
     return model;
 }
コード例 #2
0
ファイル: CarTypeService.cs プロジェクト: codedive/MyDemo1
 public CarTypeModel GetCarTypeById(int carTypeId)
 {
     //unitOfWork.StartTransaction();
     CarTypeRepository repo = new CarTypeRepository(unitOfWork);
     CarTypeModel carTypeModel = new CarTypeModel();
     CarType carType = new CarType();
     AutoMapper.Mapper.Map(carTypeModel, carType);
     carType = repo.GetAll().Where(x => x.CarTypeId == carTypeId).FirstOrDefault();
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(carType, carTypeModel);
     return carTypeModel;
 }