public async Task <IActionResult> GetUserForupdate(string userId)
        {
            ApplicationUser user = await userManager.FindByIdAsync(userId);

            HealthFacilityListModel HealthFacility = _Commonservice.GetHealthFacilityData(user.HealthFacilityCode);

            if (user != null)
            {
                RegisterModel Register = new RegisterModel
                {
                    UserID             = userId,
                    Username           = user.UserName,
                    CNIC               = user.CNIC,
                    Email              = user.Email,
                    ContactNumber      = user.PhoneNumber,
                    Password           = user.RawPassword,
                    ConfirmPassword    = user.RawConfirmPassword,
                    StartRange         = user.StartRange,
                    EndRange           = user.EndRange,
                    Identifier         = user.Identifer,
                    IMEI               = user.IMEI,
                    tehsil             = HealthFacility != null ? HealthFacility.tehsilCode : "",
                    division           = HealthFacility != null ? HealthFacility.divisionCode: "",
                    district           = HealthFacility != null ? HealthFacility.districtCode : "",
                    HealthFacilityCode = user.HealthFacilityCode
                };
                return(Ok(Register));
            }
            else
            {
                return(Ok(new Response {
                    Status = "Failed", Message = "User Not Found!"
                }));
            }
        }
Example #2
0
        public async Task <IActionResult> GetUserForupdate(string userId)
        {
            ApplicationUser user = await userManager.FindByIdAsync(userId);

            HealthFacilityListModel HealthFacility = _commonServices.GetHealthFacilityData(user.HealthFacilityCode);

            if (user != null)
            {
                RegisterModel Register = new RegisterModel
                {
                    UserID        = userId,
                    Username      = user.UserName,
                    CNIC          = user.CNIC,
                    Email         = user.Email,
                    ContactNumber = user.PhoneNumber,
                    tehsilcode    = HealthFacility != null ? HealthFacility.tehsilCode : "",
                    Division      = HealthFacility != null ? new DDLModel
                    {
                        Name = HealthFacility.DivisionName,
                        Code = HealthFacility.divisionCode
                    } : null,
                    District = HealthFacility != null ? new DDLModel
                    {
                        Name = HealthFacility.DistrictName,
                        Code = HealthFacility.districtCode
                    } : null,

                    Tehsil = HealthFacility != null ? new DDLModel
                    {
                        Name = HealthFacility.TehsilName,
                        Code = HealthFacility.tehsilCode
                    } : null,
                    HealthFacility = HealthFacility != null ? new DDLModel
                    {
                        Name = HealthFacility.HeathFacilityName,
                        Code = HealthFacility.HFMISCode
                    } : null
                };
                return(Ok(Register));
            }
            else
            {
                return(Ok(new Response {
                    Status = "Failed", Message = "User Not Found!"
                }));
            }
        }