Exemplo n.º 1
0
 public InspectorInfo GetInspectorInfoByKey(string uniquekey)
 {
     using (var context = new InspectRContext())
     {
         return context.Inspectors.FirstOrDefault(x => x.UniqueKey == uniquekey);
     }
 }
Exemplo n.º 2
0
 public InspectorInfo GetInspectorInfo(Guid id)
 {
     using (var context = new InspectRContext())
     {
         return context.Inspectors.Find(id);
     }
 }
Exemplo n.º 3
0
        public InspectorInfo Create(bool isprivate)
        {
            var inspector = new InspectorInfo()
                {
                    IsPrivate = isprivate
                };

            using (var context = new InspectRContext())
            {
                context.Inspectors.Add(inspector);
                context.SaveChanges();
            }

            return inspector;
        }
Exemplo n.º 4
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            DbContext = (InspectRContext)HttpContext.Items["InspectRContext"];
            _service = new InspectRService(DbContext);

            if (User != null)
            {
                var username = User.Identity.Name;
                if (!string.IsNullOrEmpty(username))
                {
                    // todo: map a dto
                    ViewBag.UserProfile = DbContext.GetUserProfile(username);
                }
            }

            base.OnActionExecuting(filterContext);
        }
        public void ProcessRequest(HttpContext context)
        {
            var requestCache = new RequestCache();
            var requestLogger = new Core.RequestLogger.RequestLogger(requestCache, new DefaultRequestCollector());
            var dbContext = new InspectRContext();

            var id = _requestContext.RouteData.Values["id"] as string;

            InspectorInfo inspectorInfo = dbContext.GetInspectorInfoByKey(id);

            // TODO: check private
            // ..

            dbContext.Dispose();

            if (inspectorInfo == null)
                throw new HttpException(404, "404 - Inspector Not found");

            requestLogger.LogRequest(inspectorInfo);

            // TODO: random response? :)
            context.Response.Write("ok");
        }
Exemplo n.º 6
0
 public InspectRHub()
 {
     _requestCache = new RequestCache();
     _dbContext = new InspectRContext();
     _service = new InspectRService(_dbContext);
 }
Exemplo n.º 7
0
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     DbContext = (InspectRContext)HttpContext.Items["InspectRContext"];
     _service = new InspectRService(DbContext);
     base.OnActionExecuting(filterContext);
 }
Exemplo n.º 8
0
 public InspectRService(InspectRContext dbContext)
 {
     _dbContext = dbContext;
 }