Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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;
 }