public ActionResult TrackOutfitUpdater(string updaterId, string updaterOutfitId, string updaterBuyUrl) { OutfitUpdaterView ouv = new OutfitUpdaterView(); ouv.OutifUpdaterId = updaterId; ouv.OutfitId = updaterOutfitId; ViewData.Model = ouv; return(Redirect(updaterBuyUrl)); }
/// <summary> /// Get a list of TrackinData with the info to track for the current action. /// </summary> /// <param name="filterContext">FilterContext of the executed action.</param> /// <remarks>We use the ViewData Model to get the info for some actions.</remarks> /// <returns>A list of TrackingData with the info to track.</returns> private static IEnumerable <TrackingData> GetTrackingData(ActionExecutedContext filterContext) { List <TrackingData> result = new List <TrackingData>(); string actionName = filterContext.ActionDescriptor.ActionName; switch (actionName) { case "TrackOutfitUpdater": OutfitUpdaterView ouv = filterContext.Controller.ViewData.Model as OutfitUpdaterView; if (ouv != null) { result.Add(new TrackingData(int.Parse(ouv.OutifUpdaterId), ouv.OutfitId)); } break; case "SelectFashionFlavor": List <UserFlavor> lstFlavors = filterContext.Controller.ViewData.Model as List <UserFlavor>; if (lstFlavors != null) { result.AddRange(lstFlavors.Select(userFlavor => new TrackingData(userFlavor.Flavor.Id))); } else { result.Add(new TrackingData()); } break; case "SetWeight": List <UserFlavor> lstUserFlavors = filterContext.Controller.ViewData.Model as List <UserFlavor>; if (lstUserFlavors != null) { result.AddRange( lstUserFlavors.Select( userFlavor => new TrackingData(userFlavor.Flavor.Id, userFlavor.Weight.ToString()))); } break; case "SelectEventType": List <EventType> lstEventTypes = filterContext.Controller.ViewData.Model as List <EventType>; if (lstEventTypes != null) { result.AddRange(lstEventTypes.Select(eventType => new TrackingData(eventType.Id))); } break; case "GetSilouhette": int silouhetteId = Convert.ToInt32(filterContext.Controller.ViewData.Model); result.Add(new TrackingData(silouhetteId)); break; case "TrackMyGarmentsItem": int myGarmentsId = Convert.ToInt32(filterContext.Controller.ViewData.Model); result.Add(new TrackingData(myGarmentsId)); break; case "TrackMyWishListItem": int myWishListId = Convert.ToInt32(filterContext.Controller.ViewData.Model); result.Add(new TrackingData(myWishListId)); break; case "TrackFabric": int fabricId = Convert.ToInt32(((JsonResult)filterContext.Result).Data); result.Add(new TrackingData(fabricId)); break; case "TrackPattern": int patternId = Convert.ToInt32(((JsonResult)filterContext.Result).Data); result.Add(new TrackingData(patternId)); break; case "TrackValidationError": string error = (((JsonResult)filterContext.Result).Data).ToString(); result.Add(new TrackingData(null, error)); break; default: result.Add(new TrackingData()); break; } return(result); }