Beispiel #1
0
        public ActionResult CountryInfo(string info_text, string selectedCountry)
        {
            //get the IP Address of the user
            string ipAddress = Request.ServerVariables["REMOTE_ADDR"];

            //creates a new Information object
            Information info = new Information();
            info.Information_Text = info_text;
            info.IPAddress = ipAddress;
            //Get the Country ID from the country name to store in the information object
            var countrt_id = from c in db.Countries where c.Country_Name == selectedCountry select c.Id;
            info.Country_Id = countrt_id.First();
            //Always save the current time
            info.Time = DateTime.Now;

            //Call the GetLocation method to obtain the location based on the IP Address
            info.Location = GetLocation(ipAddress);

            //Insert the information object in the database and submit the changes
            db.Informations.InsertOnSubmit(info);
            db.SubmitChanges();

            return null;
        }
 partial void DeleteInformation(Information instance);
 partial void UpdateInformation(Information instance);
		private void detach_Informations(Information entity)
		{
			this.SendPropertyChanging();
			entity.Country = null;
		}
 partial void InsertInformation(Information instance);