public void UpdateLocation(Location location)
        {
            string locationID = string.Empty;
            string locationName = string.Empty;

            try
            {
                if (String.IsNullOrEmpty(location.LocationID))
                {
                    locationID = string.Empty;
                }
                else
                {
                    locationID = location.LocationID;
                }
            }
            catch
            {
                locationID = string.Empty;
            }
            try
            {
                if (String.IsNullOrEmpty(location.LocationName))
                {
                    locationName = string.Empty;
                }
                else
                {
                    locationName = location.LocationName;
                }
            }
            catch
            {
                locationName = string.Empty;
            }

            using (MySqlConnection db = new MySqlConnection(Database.ReminderConnection))
            {
                try
                {
                    string query =
                        "update locations"
                        + " set locationID = @locationID"
                        + " , location = @locationName"
                        + " where id = @ID";

                    int rowsAffectd = db.Execute(query, new
                    {
                        @locationID = locationID,
                        @locationName = locationName,
                        @ID = location.ID
                    }
                        );
                }
                catch (Exception er)
                {
                    Log.LogMessage(er.ToString());
                }
            }
        }
        public ActionResult Put(IEnumerable<Location> location)
        {
            string toBeVoiced = string.Empty;
            try
            {
                foreach (var loc in location)
                {
                    Location singlelocation = new Location();

                    singlelocation.LocationID = loc.LocationID;
                    singlelocation.LocationName = loc.LocationName;

                    locations.AddLocation(singlelocation);
                }
                return new JsonResult { Data = new { Success = true } };
            }
            catch (Exception er)
            {
                string s1 = er.Message;
                return new JsonResult { Data = new { Success = false } };
            }
        }
        public ActionResult Put(IEnumerable<Location> location)
        {
            Database.ReminderConnection = ConfigurationManager.AppSettings["reminderConnection"];
            string toBeVoiced = string.Empty;
            try
            {
                foreach (var loc in location)
                {
                    Location singlelocation = new Location();

                    singlelocation.LocationID = loc.LocationID;
                    singlelocation.LocationName = loc.LocationName;

                    locations.AddLocation(singlelocation);
                }
                return new JsonResult { Data = new { Success = true } };
            }
            catch (Exception er)
            {
                string s1 = er.Message;
                return new JsonResult { Data = new { Success = false } };
            }
        }
        public void DeleteLocation(Location location)
        {
            using (MySqlConnection db = new MySqlConnection(Database.ReminderConnection))
            {
                try
                {
                    string query =
                        "delete from locations"
                        + " where id = @id";

                    int rowsAffectd = db.Execute(query, new
                    {
                        @id = location.ID
                    }
                        );
                }
                catch (Exception er)
                {
                    Log.LogMessage(er.ToString());
                }
            }
        }
        public void AddLocation(Location location)
        {
            using (MySqlConnection db = new MySqlConnection(Database.ReminderConnection))
            {
                try
                {
                    string query =
                        "insert into locations(locationid,location)"
                        + "values(@locationID,@location)";
                    int rowsAffectd = db.Execute(query, new
                    {
                        @locationID = location.LocationID,
                        @location = location.LocationName
                    }
                        );
                }
                catch (Exception er)
                {
                    Log.LogMessage(er.ToString());
                }
            }

        }