I've Started the beer house MVC3 project

Topics: Developer Forum, Project Management Forum, User Forum
Jun 4, 2013 at 9:49 AM
I've Started the beer house MVC3 project at chaytot.com.
I changed some code:
  1. Change in web.config to run website in host
    ___<remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=(local);Integrated Security=false;Initial Catalog=TheBeerHouse;User ID=chaytot.com;Password=chaytot.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="ApplicationServices" connectionString="data source=(local);Integrated Security=false;Initial Catalog=TheBeerHouse;User ID=chaytot.com;Password=chaytot.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="TheBeerHouseDataContext" connectionString="Data Source=(local);Integrated Security=false;Initial Catalog=TheBeerHouse;Persist Security Info=True;User ID=chaytot.com;Password=chaytot.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="DefaultConnection" connectionString="Data Source=(local);Initial Catalog=TheBeerHouse;Persist Security Info=True;User ID=chaytot.com;Password=chaytot.com;Integrated Security=false;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />___
  2. Change in function Edituser in UserController.cs file to change roles of user:
_//Is a list of all the user roles
        ArrayList removeRoleList = new ArrayList(Roles.GetAllRoles());

        //We are requesting the form variables directly from the form
        String key;
        String val="";
        for (int i = 0; i < Request.Form.Keys.Count; i++)//    (string key in Request.Form.Keys)
        {
            key=Request.Form.Keys.Get(i);
            try
            {
                val = Request.Form.GetValues(i).GetValue(0).ToString();
            }
            catch
            {
                val = "";
            }

            if (key.StartsWith("role."))
            {
                String userRole = key.Substring(5, key.Length - 5);
                if (val.EndsWith("true"))
                {
                    removeRoleList.Remove(userRole);
                }
                if (!Roles.IsUserInRole(id, userRole))
                {
                    Roles.AddUserToRole(id, userRole);
                }
            }
        }_