예제 #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");
        }
 private void detach_CrimeTag(CrimeTag entity)
 {
     this.SendPropertyChanging();
     entity.CrimeComment = null;
 }
 private void attach_CrimeTag(CrimeTag entity)
 {
     this.SendPropertyChanging();
     entity.CrimeComment = this;
 }
 partial void DeleteCrimeTag(CrimeTag instance);
 partial void UpdateCrimeTag(CrimeTag instance);
 partial void InsertCrimeTag(CrimeTag instance);