Beispiel #1
0
        public object ReportCrime(string suburb, string latitude, string longitude, string comment, string[] tags)
        {
            var currentTime = DateTime.UtcNow;
            var dbContext   = GetNewContext();

            var newCrimeComment = new CrimeComment();

            newCrimeComment.Comment       = comment;
            newCrimeComment.Suburb        = suburb;
            newCrimeComment.Latitude      = latitude;
            newCrimeComment.Longitude     = longitude;
            newCrimeComment.InputDateTime = currentTime;

            dbContext.CrimeComment.InsertOnSubmit(newCrimeComment);

            foreach (var tag in tags)
            {
                var newCrimeTag = new CrimeTag();
                newCrimeTag.HashID  = newCrimeComment.HashID;
                newCrimeTag.HashTag = tag;
                dbContext.CrimeTag.InsertOnSubmit(newCrimeTag);
            }
            dbContext.SubmitChanges();

            dbContext.Dispose();
            return("report Submitted");
        }
 partial void UpdateCrimeComment(CrimeComment instance);
 partial void DeleteCrimeComment(CrimeComment instance);
 partial void InsertCrimeComment(CrimeComment instance);