public ActionResult Index([FromUri] HomeIndexRequest model) { var traceCodeValue = ""; if (Request.Cookies[TrackCode] == null || string.IsNullOrEmpty(Request.Cookies[TrackCode].Value)) { traceCodeValue = Guid.NewGuid().ToString().ToMd5(); Response.Cookies.Add(new HttpCookie(TrackCode, traceCodeValue)); } else { traceCodeValue = Request.Cookies[TrackCode].Value; } var log = LogManager.GetLogger(typeof(object)); log.Info(string.Format(LogLineTextFormat, traceCodeValue, model.Domain, model.Uri, model.Referrer, model.ScreenWidth, model.ScreenHeight, model.ColorDepth, model.Lang, model.Account, model.Event, model.Exts)); return(new FilePathResult("ta.jpg", "image/jpeg")); }
public virtual ActionResult Index(HomeIndexRequest request) { if (!ModelState.IsValid) { return(View(request)); } try { this.ApplicationFacade.SetCurrentBadge(request.BadgeNbr); if (!this.ApplicationFacade.CurrentBadge.IsActive) { this.ApplicationFacade.AddNewOwnerToSession(this.Language); return(RedirectToAction("Index", "Activate")); } throw new NotImplementedException(); } catch (InvalidOperationException ex) { if (ex.Message.ToLower().Contains("ip")) { ModelState.AddModelError("BadgeNbr", TenantResources.Values["locked_ip"]); } ModelState.AddModelError("BadgeNbr", TenantResources.Values["err_invalidBadge"]); return(View(request)); } }
public override void Given() { base.Given(); Subject.ViewData.ModelState.AddModelError("BadgeEmpty", @"Badge is empty"); Request = new HomeIndexRequest { BadgeNbr = null }; }
public override void Given() { base.Given(); var nbr = "39393"; MockedBadgeRepository.Expect(n => n.GetBy(x => x.Nbr == nbr)).Return(null); Request = new HomeIndexRequest { BadgeNbr = nbr }; }
public override void Given() { base.Given(); var nbr = "39393"; this.MockedBadgeRepository.Expect(n => n.GetBy(x => x.Nbr == nbr)).IgnoreArguments().Return(null); this.MockedSecurityService.Expect(n => n.IsRequestorBlackListed(null)).IgnoreArguments().Return(true); this.ApplicationFacade = new ApplicationFacade(this.MockedSessionService, this.MockedDistributorService, this.MockedBadgeRepository, this.MockedDeclarationRepository, this.MockedSecurityService, this.MockedAutheticationService, this.MockedOwnerRepository, this.MockedMapperService); this.Request = new HomeIndexRequest { BadgeNbr = nbr }; this.Subject = new HomeController(this.ApplicationFacade, this.MockedMapperService); }
public override void Given() { base.Given(); this.Subject = new HomeController(this.ApplicationFacade, this.MockedMapperService); // Arange const string nbr = "abc-123-Ghj"; this.NormalizedBadgeNumber = "ABC123GHJ"; var nonActivatedBadge = new Badge { Nbr = nbr }; this.MockedBadgeRepository.Expect(n => n.GetBy(x => x.Nbr == this.NormalizedBadgeNumber)).IgnoreArguments().Return(nonActivatedBadge); Request = new HomeIndexRequest { BadgeNbr = nbr }; this.MockedSessionService.Stub(x => x["badgeNbr"]).Return(this.NormalizedBadgeNumber); }
public ActionResult EnterLabel(HomeIndexRequest request) { return(Index(request)); }
public HomeIndexViewModel Get(HomeIndexRequest request) { return new HomeIndexViewModel(); }