public void DeleteUserLocation(int id) { //unitOfWork.StartTransaction(); UserLocationRepository repo = new UserLocationRepository(unitOfWork); //UserLocationModel userLocationModel = new UserLocationModel(); UserLocation userLocation = new UserLocation(); repo.Delete(x=>x.UserLocationId==id); //unitOfWork.Commit(); }
public UserLocationModel FindLocationByUserAndCityId(string userId,int cityId) { //unitOfWork.StartTransaction(); UserLocationModel locationModel = new UserLocationModel(); UserLocationRepository repo = new UserLocationRepository(unitOfWork); UserLocation userLocation = new UserLocation(); userLocation = repo.GetAll(x => x.UserId == userId && x.CityId==cityId).FirstOrDefault(); //unitOfWork.Commit(); AutoMapper.Mapper.Map(userLocation, locationModel); return locationModel; }
public bool CheckExistance(string userId) { //unitOfWork.StartTransaction(); UserLocationRepository repo = new UserLocationRepository(unitOfWork); UserLocation userLocation = new UserLocation(); userLocation = repo.GetAll(x => x.UserId == userId).FirstOrDefault(); //unitOfWork.Commit(); if (userLocation !=null) { return true; } else { return false; } }
public UserLocationModel UpadteUserLocation(UserLocationModel model) { //unitOfWork.StartTransaction(); UserLocationRepository repo = new UserLocationRepository(unitOfWork); UserLocation userLocation = new UserLocation(); userLocation = repo.GetAll().Where(x => x.UserLocationId == model.UserLocationId).FirstOrDefault(); AutoMapper.Mapper.Map(model, userLocation); repo.Update(userLocation); //unitOfWork.Commit(); AutoMapper.Mapper.Map(userLocation, model); return model; }
public UserLocationModel InsertUserLocation(UserLocationModel locationModel) { //unitOfWork.StartTransaction(); UserLocationRepository repo = new UserLocationRepository(unitOfWork); //UserLocationModel userLocationModel = new UserLocationModel(); UserLocation userLocation = new UserLocation(); AutoMapper.Mapper.Map(locationModel, userLocation); userLocation = repo.Insert(userLocation); //unitOfWork.Commit(); AutoMapper.Mapper.Map(userLocation, locationModel); return locationModel; }