public IHttpActionResult UpdateAdminUserForParent(JObject jsonResult)
        {
            var data     = "";
            var identity = MyAuthorizationServerProvider.AuthenticateUser();

            if (identity != null)
            {
                string Message = string.Empty;
                UserBO objUser = new UserBO();

                if (identity.Role == ConstantMessages.Roles.companyadmin || identity.Role == ConstantMessages.Roles.superadmin)
                {
                    int ChildUserID = 0;
                    if (jsonResult.SelectToken("UserID") != null && jsonResult.SelectToken("UserID").ToString().Trim() != "")
                    {
                        ChildUserID = (int)jsonResult.SelectToken("UserID");

                        if (ValidateUserDetails(identity.Role, identity.CompId, jsonResult, out Message, out objUser, "update", ChildUserID))
                        {
                            objUser.UserID = identity.UserID;
                            objUser.CompId = identity.CompId;
                            objUser.Role   = identity.Role;

                            var ds = OrganizationBL.CreateUpdateAdminUser(objUser, 2, ChildUserID);
                            if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["ReturnCode"].ToString() == "1")
                            {
                                data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                                data = Utility.Successful(data);
                            }
                            else if (ds.Tables[0].Rows.Count > 0)
                            {
                                data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                                data = Utility.Failed(data);
                            }
                            else
                            {
                                data = Utility.API_Status("0", ConstantMessages.WebServiceLog.GenericErrorMsg);
                            }
                        }
                        else
                        {
                            data = Utility.API_Status("2", Message);
                        }
                    }
                    else
                    {
                        data = Utility.API_Status("2", "Please provide UserID");
                    }
                }
                else
                {
                    data = Utility.API_Status("3", "You do not have access for this functionality");
                }
            }
            else
            {
                data = Utility.AuthenticationError();
            }
            return(new APIResult(Request, data));
        }
        public IHttpActionResult CreateAdminUser(JObject jsonResult)
        {
            var data     = "";
            var identity = MyAuthorizationServerProvider.AuthenticateUser();

            if (identity != null)
            {
                string Message = string.Empty;
                UserBO objUser = new UserBO();

                if (identity.Role == ConstantMessages.Roles.superadmin)//identity.Role == ConstantMessages.Roles.companyadmin ||
                {
                    if (ValidateUserDetails(identity.Role, identity.CompId, jsonResult, out Message, out objUser, "create", Convert.ToInt32(identity.UserID)))
                    {
                        objUser.UserID = identity.UserID;
                        objUser.CompId = identity.CompId;
                        objUser.Role   = identity.Role;

                        var ds = OrganizationBL.CreateUpdateAdminUser(objUser, 1, 0);
                        if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["ReturnCode"].ToString() == "1")
                        {
                            data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                            data = Utility.Successful(data);

                            EmailHelper.GetEmailContent(Convert.ToInt32(ds.Tables[0].Rows[0]["InsertedID"]), 0, EmailHelper.Functionality.CREATE_ORG, "", "");
                        }
                        else if (ds.Tables[0].Rows.Count > 0)
                        {
                            data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                            data = Utility.Failed(data);
                        }
                        else
                        {
                            data = Utility.API_Status("0", "No data found");
                        }
                    }
                    else
                    {
                        data = Utility.API_Status("2", Message);
                    }
                }
                else
                {
                    data = Utility.API_Status("3", "You do not have access for this functionality");
                }
            }
            else
            {
                data = Utility.AuthenticationError();
            }
            return(new APIResult(Request, data));
        }