// // GET: /Analytics/RelatedIndustry/ public ActionResult Competitor(long placeId, long primaryIndustryId, long relatedIndustryId) { Guid?userid = null; if (User.Identity.IsAuthenticated) { userid = (Guid)Membership.GetUser().ProviderUserKey; } var item = new RelatedCompetitor() { PrimaryIndustryId = primaryIndustryId, RelatedIndustryId = relatedIndustryId, PlaceId = placeId, UserId = userid }; Singleton <Tracker> .Instance.RelatedCompetitor(item); return(Json(true, JsonRequestBehavior.AllowGet)); }
public void RelatedCompetitor(RelatedCompetitor reg) { TimeStamp stamp = new TimeStamp(); reg.Day = stamp.Day; reg.Hour = stamp.Hour; reg.Minute = stamp.Minute; reg.Month = stamp.Month; reg.Quarter = stamp.Quarter; reg.Year = stamp.Year; reg.Week = stamp.Week; reg.Timestamp = stamp.Stamp; reg.Session = APIContext.Current.Session; Task.Factory.StartNew(() => { using (var context = ContextFactory.AnalyticsContext) { context.RelatedCompetitors.AddObject(reg); context.SaveChanges(); } }); }