public async Task <PractitionerSession> GetSession(int sessionId) { try { PractitionerSession session = new PractitionerSession(); session = await(from sesion in this.therapistContext.Session join topic in this.therapistContext.MasterTopic on sesion.TopicId equals topic.TopicId join sessiontype in this.therapistContext.MasterSessionType on sesion.SessionType equals sessiontype.TypeId where sesion.SessionId.Equals(sessionId) && sesion.IsActive.Equals(true) && sesion.IsDeleted.Equals(false) select new PractitionerSession { SessionId = sesion.SessionId, UserId = sesion.UserId, SessionTitle = sesion.SessionTitle, TopicName = topic.TopicName, SessionType = sessiontype.TypeName, SessionShotDescription = sesion.SessionShotDescription, SessionDescription = sesion.SessionDescription, SessionDate = sesion.SessionDate, SessionTime = sesion.SessionTime, SessionLength = sesion.SessionLength, NumberOfSeats = sesion.NumberOfSeats, SeatPrice = sesion.SeatPrice, PublishDate = sesion.PublishDate, PublishTime = sesion.PublishTime }).FirstOrDefaultAsync(); return(session); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> GetSession(int sessionId) { JsonResponse <PractitionerSession> objResult = new JsonResponse <PractitionerSession>(); try { PractitionerSession session = new PractitionerSession(); session = await this._settingService.GetSession(sessionId); if (session != null) { objResult.Data = session; objResult.Status = StaticResource.SuccessStatusCode; objResult.Message = StaticResource.SuccessMessage; return(new OkObjectResult(objResult)); } else { objResult.Data = null; objResult.Status = StaticResource.NotFoundStatusCode; objResult.Message = StaticResource.NotFoundMessage; 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)); }