Esempio n. 1
0
        public async Task <IActionResult> GetCompanyRate(int userId)
        {
            JsonResponse <RatePlanInfo> objResult = new JsonResponse <RatePlanInfo>();

            try
            {
                RatePlanInfo planInfo = new RatePlanInfo();
                planInfo = await this._companyService.getCompanyRatePlan(userId);

                if (planInfo != null)
                {
                    objResult.Data    = planInfo;
                    objResult.Status  = StaticResource.SuccessStatusCode;
                    objResult.Message = StaticResource.SuccessMessage;
                    return(new OkObjectResult(objResult));
                }
            }
            catch (Exception ex)
            {
                HttpContext.RiseError(ex);
                objResult.Data    = null;
                objResult.Status  = StaticResource.FailStatusCode;
                objResult.Message = StaticResource.FailMessage;
            }
            return(new OkObjectResult(objResult));
        }
Esempio n. 2
0
 public async Task <RatePlanInfo> getCompanyRatePlan(int userId)
 {
     try
     {
         RatePlanInfo info = new RatePlanInfo();
         info = await(from rate in this.therapistContext.CompanyRatePlan
                      join plan in this.therapistContext.MasterPlan
                      on rate.PlanId equals plan.PlanId
                      join usercompany in this.therapistContext.UserCompany
                      on rate.CompanyId equals usercompany.CompanyId
                      where usercompany.UserId == userId && usercompany.IsActive == true && usercompany.IsDeleted == false && rate.IsActive == true && rate.IsDeleted == false && rate.ActivePlan == 1
                      select new RatePlanInfo
         {
             PlanName           = plan.PlanName,
             PlanAmount         = plan.PlanAmount,
             PlanStartDate      = rate.PlanStartDate,
             PlanEndDate        = rate.PlanEndDate,
             IsRecurring        = rate.IsRecurring,
             Active             = rate.ActivePlan == 1 ? true : false,
             PlanId             = plan.PlanId,
             CompanyRateTableId = rate.CompanyRateTableId
         }).FirstOrDefaultAsync();
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }