コード例 #1
0
ファイル: UserPlanService.cs プロジェクト: codedive/MyDemo1
 public UserPlanModel InsertUserPlan(UserPlanModel planModel)
 {
     //unitOfWork.StartTransaction();
     UserPlanRepository repo = new UserPlanRepository(unitOfWork);
     //UserLocationModel userLocationModel = new UserLocationModel();
     UserPlan userPlan = new UserPlan();
     AutoMapper.Mapper.Map(planModel, userPlan);
     userPlan = repo.Insert(userPlan);
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(userPlan, planModel);
     return planModel;
 }
コード例 #2
0
ファイル: UserPlanService.cs プロジェクト: codedive/MyDemo1
 public bool CheckExistanceOfUserPlan(string userId)
 {
     //unitOfWork.StartTransaction();
     UserPlanRepository repo = new UserPlanRepository(unitOfWork);
     UserPlan userPlan = new UserPlan();
     userPlan = repo.GetAll().Where(x => x.UserId == userId).FirstOrDefault();
     //unitOfWork.Commit();
     if (userPlan != null)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #3
0
ファイル: UserPlanService.cs プロジェクト: codedive/MyDemo1
 public UserPlanModel GetUserPlanByUserId(string userId)
 {
     //unitOfWork.StartTransaction();
     UserPlanRepository repo = new UserPlanRepository(unitOfWork);
     UserPlanModel userPlanModel = new UserPlanModel();
     UserPlan userPlan = new UserPlan();
     userPlan = repo.GetAll().Where(x=>x.UserId==userId && x.ExpiredDate > DateTime.UtcNow).FirstOrDefault();
     //if (userPlan == null)
     //{
     //    UserPlan checkPlan = new UserPlan();
     //    checkPlan = repo.GetAll().Where(x => x.UserId == userId).FirstOrDefault();
     //    repo.Delete(x=>x.Id== checkPlan.Id);
     //}
     //unitOfWork.Commit();
     AutoMapper.Mapper.Map(userPlan, userPlanModel);
     return userPlanModel;
 }