/// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;

            return(View("DisplayCompany"));
        }
        private ServiceBusResponse infoSearch(GetCompanyInfoRequest infoRequest)
        {
            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("CompanyListings");
            return(requestingEndpoint.Request <ServiceBusResponse>(infoRequest, sendOptions).ConfigureAwait(false).GetAwaiter().GetResult());
        }
Exemplo n.º 3
0
        public GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            send(request);
            ServiceBusResponse resp = readUntilEOF();

            return((GetCompanyInfoResponse)resp);
        }
Exemplo n.º 4
0
        public GetCompanyInfoResponse getCompany(GetCompanyInfoRequest request)
        {
            bool            result  = false;
            string          message = "";
            CompanyInstance company = null;

            string query = @"SELECT * FROM " + databaseName + @".companies WHERE companyname='" +
                           request.companyInfo.companyName + @"';";

            if (openConnection() == true)
            {
                try
                {
                    MySqlCommand    command    = new MySqlCommand(query, connection);
                    MySqlDataReader dataReader = command.ExecuteReader();


                    if (dataReader.Read())
                    {
                        string companyname = dataReader.GetString("companyname");
                        string phonenumber = dataReader.GetString("phonenumber");
                        string email       = dataReader.GetString("email");
                        string location    = dataReader.GetString("location");

                        company = new CompanyInstance(companyname, phonenumber, email, new string[] { location });
                    }
                    else
                    {
                        throw new Exception("Reader cannot read. DirectoryServiceDatabase Error.");
                    }

                    dataReader.Close();
                    result = true;
                }
                catch (MySqlException e)
                {
                    Messages.Debug.consoleMsg("Unable to complete select from company into database." +
                                              " Error :" + e.Number + e.Message);
                    Messages.Debug.consoleMsg("The query was:" + query);
                    message = e.Message;
                }
                catch (Exception e)
                {
                    Messages.Debug.consoleMsg("Unable to Unable to complete insert new user into database." +
                                              " Error:" + e.Message);
                    message = e.Message;
                }
                finally
                {
                    closeConnection();
                }
            }
            else
            {
                message = "Unable to connect to database";
            }
            return(new GetCompanyInfoResponse(result, message, company));
        }
Exemplo n.º 5
0
        private ServiceBusResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            if (authenticated == false)
            {
                return(new GetCompanyReviewsResponse(false, "Error: You must be logged in to use the company look up functionality.", null));
            }

            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("Company");
            return(requestingEndpoint.Request <ServiceBusResponse>(request, sendOptions).ConfigureAwait(false).GetAwaiter().GetResult());
        }
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;

            GetWeatherRequest  weatherRequest  = new GetWeatherRequest(infoResponse.companyInfo.city, infoResponse.companyInfo.province);
            GetWeatherResponse weatherResponse = connection.getWeather(weatherRequest);

            ViewBag.foundWeather = weatherResponse.result;
            if (weatherResponse.result)
            {
                ViewBag.currentTemp = weatherResponse.weather.Temperature.Metric.Value;
                ViewBag.feelTemp    = weatherResponse.weather.RealFeelTemperature.Metric.Value;
                ViewBag.weatherText = weatherResponse.weather.WeatherText;
                WeatherIcon url = new WeatherIcon();
                ViewBag.weatherIconURL = url.weatherURL[weatherResponse.weather.WeatherIcon];
            }
            else
            {
                ViewBag.currentTemp = "N/A";
                ViewBag.feelTemp    = "N/A";
                ViewBag.weatherText = "N/A";
            }

            string            company        = ViewBag.CompanyName;
            GetReviewRequest  reviewRequest  = new GetReviewRequest(company);
            GetReviewResponse reviewResponse = connection.getCompanyReviews(reviewRequest);

            ViewBag.companyReviews = reviewResponse.reviews;

            return(View("DisplayCompany"));
        }
Exemplo n.º 7
0
        private ServiceBusResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            if (authenticated == false)
            {
                return(new ServiceBusResponse(false, "Error: You must be logged in to use the search companies functionality."));
            }
            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("CompanyDirectory");

            return(requestingEndpoint.Request <GetCompanyInfoResponse>(request, sendOptions).ConfigureAwait(false).GetAwaiter().GetResult());
            //return new ServiceBusResponse(true, "Getting Company Info");
        }
        /// <summary>
        /// Gets the database to return information about the given company
        /// </summary>
        /// <param name="companyName">The name of the company to search for</param>
        /// <returns>String representation of the company being searched for</returns>
        private GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            if (authenticated == false)
            {
                return(new GetCompanyInfoResponse(false, "Must be logged in to use the Company DIrectory Service", null));
            }

            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("CompanyDirectory");

            return(requestingEndpoint.Request <GetCompanyInfoResponse>(request, sendOptions)
                   .ConfigureAwait(false).GetAwaiter().GetResult());
        }
Exemplo n.º 9
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;
            companyNameeeee     = id;
            string location = "";

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;
            location            = infoResponse.companyInfo.locations[0];

            //CompanyReviewSearchRequest reviewRequest = new CompanyReviewSearchRequest(id);
            // CompanyReviewResponse reviewResponse = connection.searchCompanyReview(reviewRequest);
            // ViewBag.Reviewlist = reviewResponse.reviews;

            WeatherNeededRequest  weatherRequest  = new WeatherNeededRequest(location);
            WeatherNeededResponse weatherResponse = connection.getWeatherData(weatherRequest);

            if (!weatherResponse.result)
            {
                WeatherData wd = new WeatherData("not available", "not available", "not available", "not available", "not available", "not available");
                ViewBag.WeatherData = wd;
            }
            else
            {
                ViewBag.WeatherData = weatherResponse.weatherData;
            }



            return(View("DisplayCompany"));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Publishes an EchoEvent.
        /// </summary>
        /// <param name="request">The data to be echo'd back to the client</param>
        /// <returns>The data sent by the client</returns>
        private ServiceBusResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            if (authenticated == false)
            {
                return(new ServiceBusResponse(false, "Error: You must be logged in to use the Company Directory company info request."));
            }

            // This class indicates to the request function where
            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("CompanyDirectory");


            return(requestingEndpoint.Request <ServiceBusResponse>(request, sendOptions).
                   ConfigureAwait(false).GetAwaiter().GetResult());;
        }
        /// <summary>
        /// Sends the data to the echo service, and returns the response.
        /// </summary>
        /// <param name="request">The data sent by the client</param>
        /// <returns>The response from the echo service</returns>
        private GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            if (authenticated == false)
            {
                return(new GetCompanyInfoResponse(false, "Error: You must be logged in to use the echo reverse functionality.", null));
            }

            // This class indicates to the request function where
            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("CompanyDirectory");

            // The Request<> funtion itself is an asynchronous operation. However, since we do not want to continue execution until the Request
            // function runs to completion, we call the ConfigureAwait, GetAwaiter, and GetResult functions to ensure that this thread
            // will wait for the completion of Request before continueing.
            return(requestingEndpoint.Request <GetCompanyInfoResponse>(request, sendOptions).
                   ConfigureAwait(false).GetAwaiter().GetResult());
        }
Exemplo n.º 12
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if (String.IsNullOrWhiteSpace(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;


            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;

            if (infoResponse.result)
            {
                GetCompanyReviewsRequest  request = new GetCompanyReviewsRequest(id);
                GetCompanyReviewsResponse result  = connection.getReviews(request);
                ViewBag.Reviews = result;
            }
            else
            {
                return(View("Index"));
            }

            WeatherRequest  weatherRequest  = new WeatherRequest(infoResponse.companyInfo.locations[0]);
            WeatherResponse weatherResponse = connection.getWeather(weatherRequest);

            ViewBag.WeatherResponse = weatherResponse;

            return(View("DisplayCompany"));
        }
        ///<summary>
        ///Retrieves company info based on company name
        ///</summary>
        ///<param name="compo">Information about the company</param>
        public GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest compo)
        {
            if (openConnection())
            {
                GetCompanyInfoResponse toReturn = new GetCompanyInfoResponse(false, "Could not find any company information.", null);
                try
                {
                    string query = @"SELECT * FROM " + databaseName + @".Companies " +
                                   @"WHERE companyName='" + compo.companyInfo.companyName + @"';";

                    MySqlCommand    command    = new MySqlCommand(query, connection);
                    MySqlDataReader dataReader = command.ExecuteReader();

                    if (dataReader.Read())
                    {
                        string[] loc = new string[1];
                        loc[0] = dataReader.GetString("location");
                        CompanyInstance cump = new CompanyInstance(dataReader.GetString("companyName"), dataReader.GetString("phoneNumber"), dataReader.GetString("email"), loc);
                        toReturn = new GetCompanyInfoResponse(true, "Successfully retrieved company information.", cump);
                    }
                }
                catch (Exception a)
                {
                    Console.WriteLine("Issue saving company to the database.");
                    Console.WriteLine(a.Message);
                }
                finally
                {
                    closeConnection();
                }
                return(toReturn);
            }
            else
            {
                Debug.consoleMsg("Unable to connect to database");
                return(new GetCompanyInfoResponse(false, "Could not find any company information.", null));
            }
        }
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;
            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            if (infoResponse.result)
            {
                ViewBag.CheckReviews = true;
                ViewBag.CompanyInfo  = infoResponse.companyInfo;
                if (infoResponse.companyInfo.reviewList.reviews == null)
                {
                    ViewBag.CheckReviews = false;
                }
                else
                {
                    List <ReviewInstance> r     = infoResponse.companyInfo.reviewList.reviews;
                    string[] timestamp_readable = new string[r.Count];

                    for (int i = 0; i < timestamp_readable.Length; i++)
                    {
                        System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                        dtDateTime            = dtDateTime.AddSeconds(Convert.ToInt64(r[i].timestamp)).ToLocalTime();
                        timestamp_readable[i] = Convert.ToString(dtDateTime);
                    }
                    ViewBag.Timestamp = timestamp_readable;
                }
            }

            //Still assume location array is of one value.
            GetWeatherRequest weatherRequest = new GetWeatherRequest(new CompanyWeather {
                location = infoResponse.companyInfo.locations[0]
            });
            GetWeatherResponse weatherResponse = connection.getWeather(weatherRequest);

            if (!weatherResponse.result)
            {
                ViewBag.success = false;
            }
            else
            {
                ViewBag.success     = true;
                ViewBag.realFeel    = weatherResponse.companyWeather.realFeelTemperature;
                ViewBag.temp        = weatherResponse.companyWeather.temperature;
                ViewBag.weatherText = weatherResponse.companyWeather.weatherText;
            }

            return(View("DisplayCompany"));
        }
Exemplo n.º 15
0
 /// <summary>
 /// Sends the data to be echo'd to the service bus
 /// </summary>
 /// <param name="request">The data to be echo'd</param>
 /// <returns>The response from the servicebus</returns>
 public GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
 {
     send(request);
     return((GetCompanyInfoResponse)readUntilEOF());
 }
        /// <summary>
        /// Searches the database for a company matching the given name
        /// </summary>
        /// <param name="name">The name of the company to search for</param>
        /// <returns>Info about the company being returned</returns>
        public GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
        {
            bool            result      = false;
            string          response    = "";
            CompanyInstance requestData = request.companyInfo;

            if (openConnection() == true)
            {
                string query = @"SELECT * FROM " + databaseName + @".company " +
                               @"WHERE companyname='" + requestData.companyName + @"';";
                MySqlDataReader dataReader = null;
                CompanyInstance returnData = null;

                try
                {
                    MySqlCommand command = new MySqlCommand(query, connection);

                    dataReader = command.ExecuteReader();

                    if (!dataReader.Read())
                    {
                        return(new GetCompanyInfoResponse(false, "No company with the given name exists in our database.", requestData));
                    }
                    string        companyName = dataReader.GetString("companyname");
                    string        phoneNumber = dataReader.GetString("phonenumber");
                    string        email       = dataReader.GetString("email");
                    List <string> locations   = new List <string>();

                    dataReader.Close();

                    query = @"SELECT * FROM " + databaseName + @".location " +
                            @"WHERE companyname='" + requestData.companyName + @"';";

                    command = new MySqlCommand(query, connection);

                    dataReader = command.ExecuteReader();

                    while (dataReader.Read())
                    {
                        locations.Add(dataReader.GetString("address"));
                    }

                    returnData = new CompanyInstance(
                        companyName, phoneNumber, email, locations.ToArray()
                        );

                    result = true;
                }
                catch (Exception e)
                {
                    response = e.Message;
                }
                finally
                {
                    if (dataReader != null && dataReader.IsClosed == false)
                    {
                        dataReader.Close();
                    }
                    closeConnection();
                }

                return(new GetCompanyInfoResponse(result, response, returnData));
            }
            return(new GetCompanyInfoResponse(false, "Unable to connect to database", null));
        }
Exemplo n.º 17
0
 //TODO: CHANGE RETURN TYPE TO ServiceBusResponse
 public ServiceBusResponse getCompanyInfo(GetCompanyInfoRequest request)
 {
     send(request);
     return(readUntilEOF());
 }
Exemplo n.º 18
0
 /** This needs to be done by us - Anil**/
 public GetCompanyInfoResponse getCompanyInfo(GetCompanyInfoRequest request)
 {
     return(null);
 }
Exemplo n.º 19
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;

            GetCompanyInfoRequest infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            ServiceBusResponse    infoResponse = connection.getCompanyInfo(infoRequest);



            String[] responseToArray = infoResponse.response.Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            String[] locations       = new String[responseToArray.Length - 3];

            Array.Copy(responseToArray, 3, locations, 0, responseToArray.Length - 3);
            CompanyInstance value = new CompanyInstance(responseToArray[0], responseToArray[1], responseToArray[2], locations);

            ViewBag.CompanyInfo = value;
            ViewBag.username    = Globals.getUser();
            ViewBag.time        = DateTime.Now.ToString();


            //Harjee format the string into an array or something, then display it nicely on the view
            string reviews = GetReview(value.companyName);

            if (!reviews.Contains(":]"))
            {
                JObject json = JObject.Parse(reviews);

                JProperty allReviews = json.Property("reviews");

                string   totalReviews       = allReviews.Value.ToString();
                string[] unformattedResults = totalReviews.Split(',');

                for (int i = 4; i < unformattedResults.Length; i += 5)
                {
                    int position = unformattedResults[i].IndexOf('}');

                    if (position < 0)
                    {
                        position = unformattedResults[i].IndexOf(']');
                    }

                    if (position >= 0)
                    {
                        unformattedResults[i] = unformattedResults[i].Substring(0, position);
                    }
                }
                if (unformattedResults.Length > 2)
                {
                    for (int i = 0; i < unformattedResults.Length; i += 5)
                    {
                        int      reviewNumber = (i / 5) + 1;
                        string[] temp         = unformattedResults[i + 1].Split(':');
                        ViewBag.reviews += "Review #" + reviewNumber + ": ";
                        ViewBag.reviews += temp[1];
                        ViewBag.reviews += " <br/> ";

                        temp             = unformattedResults[i + 2].Split(':');
                        ViewBag.reviews += "Stars: ";
                        ViewBag.reviews += temp[1];
                        ViewBag.reviews += " <br/> ";

                        temp             = unformattedResults[i + 3].Split(':');
                        ViewBag.reviews += "Timestamp: ";
                        ViewBag.reviews += temp[1];
                        ViewBag.reviews += " <br/> ";

                        temp             = unformattedResults[i + 4].Split(':');
                        ViewBag.reviews += "Username: "******" <br/> <br/> ";
                    }

                    ViewBag.reviews += " <br/> ";
                }
            }

            else
            {
                ViewBag.reviews = " No reviews found <br/> ";
            }

            //Call Weather Service

            WeatherServiceRequest  info     = new WeatherServiceRequest(value.locations[0]);
            WeatherServiceResponse response = (WeatherServiceResponse)connection.getWeather(info);

            ViewBag.weatherText         = response.returnData.weatherText;
            ViewBag.temperature         = response.returnData.temperature;
            ViewBag.realFeelTemperature = response.returnData.realFeelTemperature;
            if (response.returnData.weatherIcon < 10)
            {
                ViewBag.weatherIcon = "https://apidev.accuweather.com/developers/Media/Default/WeatherIcons/0" + response.returnData.weatherIcon + "-s.png";
            }
            else
            {
                ViewBag.weatherIcon = "https://apidev.accuweather.com/developers/Media/Default/WeatherIcons/" + response.returnData.weatherIcon + "-s.png";
            }


            return(View("DisplayCompany"));
        }
Exemplo n.º 20
0
        public ActionResult DisplayReviews(string id)
        {
            //Check if user is logged in
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            //Check the the company name was not null
            if ("".Equals(id))
            {
                return(View("Index"));
            }
            ViewBag.CompanyName = id;
            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                //If can't connect to db, return false to view
                ViewBag.CompanyExists = false;
                return(View("DisplayReviews"));
            }

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            if (!infoResponse.result)
            {
                //If company doesn't exist in db, return false to view
                ViewBag.CompanyExists = false;
                return(View("DisplayReviews"));
            }
            //Otherwise company eixsts
            ViewBag.CompanyExists = true;

            var companyReviewClient = new HttpClient();
            var jsonObject          = JsonConvert.SerializeObject(new CompanyName()
            {
                companyName = id
            });
            var stringContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");
            //This url is the one where the rest call it to
            var         res       = companyReviewClient.PostAsync("http://35.226.157.66/Home/GetCompanyReview", stringContent).Result.Content.ReadAsStringAsync().Result;
            GetResponse resObject = JsonConvert.DeserializeObject <GetResponse>(res);

            int?   totalStars   = 0;
            int    totalReviews = 0;
            string avgStars     = "0.00";

            //Check if any reviews were returned
            if (resObject.reviews != null)
            {
                //Loop reviews calculating avg stars
                foreach (var review in resObject.reviews)
                {
                    totalStars += review.stars;
                    totalReviews++;
                }
                avgStars = ((float)totalStars / totalReviews).ToString("0.00");
            }
            //Pass all to display
            ViewBag.AvgStars   = avgStars;
            ViewBag.ReviewList = resObject.reviews;
            return(View("DisplayReviews"));
        }
 private ServiceBusResponse getCompanyInfo(GetCompanyInfoRequest request)
 {
     return(new ServiceBusResponse(true, "Getting Company Info"));
 }