public async Task <ActionResult <CommonAPIResponse <GradeReturnDTO> > > GetGradeById(int id)
        {
            #region Vars
            GradeReturnDTO GradeReturnDTO = null;
            #endregion
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <object>();
            #endregion
            try
            {
                if (id != default(int))
                {
                    GradeReturnDTO = await GradeAppService.GetGradeById(id);
                }

                #region Validate userIdentityDTO for nullability before prepaing the response.
                if (GradeReturnDTO != null)
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), GradeReturnDTO, HttpStatusCode.OK);
                }
                else
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), new object(), HttpStatusCode.BadRequest);
                }
                #endregion
            }
            catch (Exception exception)
            {
            }
            return(jsonResult);
        }
 /// <summary>
 /// Get  Grade By Id
 /// </summary>
 /// <returns>GradeReturnDTO<GradeReturnDTO></returns>
 public async Task <GradeReturnDTO> GetGradeById(int GradeId)
 {
     #region Declare a return type with initial value.
     GradeReturnDTO Grade = null;
     #endregion
     try
     {
         if (GradeId > default(int))
         {
             Grade = await GradeBusinessMapping.GetGradeById(GradeId);
         }
     }
     catch (Exception exception)  {}
     return(Grade);
 }
Beispiel #3
0
 public GradeReturnDTO MappingGradeToGradeReturnDTO(Grade Grade)
 {
     #region Declare a return type with initial value.
     GradeReturnDTO GradeReturnDTO = null;
     #endregion
     try
     {
         if (Grade != null)
         {
             GradeReturnDTO = new GradeReturnDTO
             {
                 GradeId   = (byte)Grade.GradeId,
                 GradeName = Grade.GradeName
             };
         }
     }
     catch (Exception exception)
     { }
     return(GradeReturnDTO);
 }
Beispiel #4
0
        /// <summary>
        /// Get user Action Activity Log By Id
        /// </summary>
        /// <returns>List<GradeReturnDTO></returns>
        public async Task <GradeReturnDTO> GetGradeById(int GradeId)
        {
            #region Declare a return type with initial value.
            GradeReturnDTO Grade = new GradeReturnDTO();
            #endregion
            try
            {
                Grade grade = await UnitOfWork.GradeRepository.GetById((byte)GradeId);

                if (grade != null)
                {
                    if (grade.IsDeleted != (byte)DeleteStatusEnum.Deleted)
                    {
                        Grade = GradeMapping.MappingGradeToGradeReturnDTO(grade);
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(Grade);
        }