Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }