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