public async Task <ActionResult <CommonAPIResponse <AdminReturnDTO> > > GetAdminById(int id) { #region Vars AdminReturnDTO AdminReturnDTO = null; #endregion #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <object>(); #endregion try { if (id != default(int)) { AdminReturnDTO = await AdminAppService.GetAdminById(id); } #region Validate userIdentityDTO for nullability before prepaing the response. if (AdminReturnDTO != null) { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), AdminReturnDTO, HttpStatusCode.OK); } else { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), new object(), HttpStatusCode.BadRequest); } #endregion } catch (Exception exception) { } return(jsonResult); }
/// <summary> /// Get Admin By Id /// </summary> /// <returns>AdminReturnDTO<AdminReturnDTO></returns> public async Task <AdminReturnDTO> GetAdminById(int AdminId) { #region Declare a return type with initial value. AdminReturnDTO Admin = null; #endregion try { if (AdminId > default(int)) { Admin = await AdminBusinessMapping.GetAdminById(AdminId); } } catch (Exception exception) {} return(Admin); }
public AdminReturnDTO MappingAdminToAdminReturnDTO(Admin Admin) { #region Declare a return type with initial value. AdminReturnDTO AdminReturnDTO = null; #endregion try { if (Admin != null) { AdminReturnDTO = new AdminReturnDTO { AdminId = Admin.AdminId, FullName = Admin.FullName }; } } catch (Exception exception) { } return(AdminReturnDTO); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<AdminReturnDTO></returns> public async Task <AdminReturnDTO> GetAdminById(int AdminId) { #region Declare a return type with initial value. AdminReturnDTO Admin = new AdminReturnDTO(); #endregion try { Admin admin = await UnitOfWork.AdminRepository.GetById(AdminId); if (admin != null) { if (admin.IsDeleted != (byte)DeleteStatusEnum.Deleted) { Admin = AdminMapping.MappingAdminToAdminReturnDTO(admin); } } } catch (Exception exception) { } return(Admin); }