/// <summary> /// Se ejecuta cuando el usuario termino de seleccionar sus Flavors a través del asistente. /// </summary> /// <param name="Flavor1Id">Id del primer flavor que dio como resultado el Quiz.</param> /// <param name="Flavor2Id">Id del segundo flavor que dio como resultado el Quiz.</param> /// <returns>Si el asistente devuelve: /// - 1 Flavor: Actualiza los flavos con el flavor resultante. /// - 2 Flavors: Rediecciona a la página de FlavorWeight. /// <returns> public ActionResult QuizCompleted(string Flavor1Id, string Flavor2Id) { List <FashionFlavor> selectedFF = new List <FashionFlavor>(); selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(Flavor1Id))); if (!string.IsNullOrEmpty(Flavor2Id)) { selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(Flavor2Id))); } ClosetState.SetFlavors(selectedFF); if (selectedFF.Count < 2) { IList <UserFlavor> userFlavors = new List <UserFlavor>(); if (selectedFF != null) { userFlavors.Add(new UserFlavor(selectedFF[0], Convert.ToDecimal(100))); ClosetState.SetUserFlavors(userFlavors); } Session["previousUrl"] = "FlavorSelect"; return(RedirectToAction("UpdateUserFlavors", new { Flavor1Weight = 100 })); } return(RedirectToAction("Index", "FlavorWeight")); }
public RedirectToRouteResult SelectFashionFlavor(FormCollection values) { List <FashionFlavor> selectedFF = new List <FashionFlavor>(); foreach (var value in values) { object o = values[value.ToString()]; if (o.ToString().Contains("true")) { selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(value.ToString().Split('_')[2]))); } } Session["FashionFlavorSelected"] = selectedFF; if (selectedFF.Count < 2) { IList <UserFlavor> userFlavors = new List <UserFlavor>(); if (selectedFF != null) { userFlavors.Add(new UserFlavor(selectedFF[0], Convert.ToDecimal(100))); Session["UserFlavorSelected"] = userFlavors; } Session["previousUrl"] = "Index"; return(RedirectToAction("EventTypeSelector")); } return(RedirectToAction("FlavorWeight")); }
public RedirectToRouteResult ContinueBuilding(string Flavor1Id, string Flavor2Id) { List <FashionFlavor> selectedFF = new List <FashionFlavor>(); selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(Flavor1Id))); if (!string.IsNullOrEmpty(Flavor2Id)) { selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(Flavor2Id))); } ClosetState.SetFlavors(selectedFF); if (selectedFF.Count < 2) { IList <UserFlavor> userFlavors = new List <UserFlavor>(); if (selectedFF != null) { userFlavors.Add(new UserFlavor(selectedFF[0], Convert.ToDecimal(100))); ClosetState.SetUserFlavors(userFlavors); } Session["previousUrl"] = "FlavorSelect"; return(RedirectToAction("EventTypeSelector")); } return(RedirectToAction("Index", "FlavorWeight")); }
public RedirectToRouteResult SelectFashionFlavor(FormCollection values) { List <FashionFlavor> selectedFF = new List <FashionFlavor>(); foreach (var value in values) { object o = values[value.ToString()]; if (o.ToString().Contains("true")) { selectedFF.Add(fashionFlavorRepository.Get(Convert.ToInt32(value.ToString().Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries)[2]))); } } if (ClosetState.Flavors != null) { foreach (FashionFlavor fashionFlavor in selectedFF) { if (ClosetState.Flavors.Count != selectedFF.Count || !ClosetState.Flavors.Contains(fashionFlavor)) { ClosetState.ClearGarments(); } } } ClosetState.SetFlavors(selectedFF); if (selectedFF.Count < 2) { IList <UserFlavor> userFlavors = new List <UserFlavor>(); userFlavors.Add(new UserFlavor(selectedFF[0], Convert.ToDecimal(100))); ClosetState.SetUserFlavors(userFlavors); ViewData.Model = userFlavors; Session["previousUrl"] = "FlavorSelect"; return(((bool)Session["updateFlavors"]) ? RedirectToAction("UpdateUserFlavors", "FlavorChange", new { Flavor1Weight = 100 }) : RedirectToAction("Index", "EventTypeSelector")); } return(RedirectToAction("Index", "FlavorWeight")); }
public ViewResult ChangeFlavor(string FashionFlavorAlternative, string NewGarmentsItems, string NewWishListItems) { MembershipUser mu = Membership.GetUser(); RegisteredUser user = registeredUserRepository.GetByMembershipId(Convert.ToInt32(mu.ProviderUserKey)); GarmentsListData gld = new GarmentsListData(); gld.FashionFlavors.Add(fashionFlavorRepository.Get(Convert.ToInt32(FashionFlavorAlternative))); gld.NewGarmentsIds = NewGarmentsItems; gld.NewWishGarmentsIds = NewWishListItems; GetGarmentsListData(user, gld); return(View("Index", gld)); }
private void SaveData(ContentView content, int[] flavors) { IList <FashionFlavor> lstFlavors = new List <FashionFlavor>(); if (flavors != null) { for (int i = 0; i < flavors.Length; i++) { lstFlavors.Add(fashionFlavorRepository.Get(flavors[i])); } } IList <ContentSection> lstSections = new List <ContentSection>(); foreach (ContentViewSection cs in content.Sections) { lstSections.Add(new ContentSection { Body = cs.Body, Title = cs.Title, FashionFlavor = cs.FashionFlavor }); } if (content.Id == 0) { contentManagerService.Create(content.Title, content.Body, content.Keywords, content.PromotionalText, new ContentCategory(content.Category.Value), Convert.ToInt32(Membership.GetUser().ProviderUserKey), lstFlavors, lstSections); } else { contentManagerService.Edit(content.Id, content.Title, content.Body, content.Keywords, content.PromotionalText, new ContentCategory(content.Category.Value), (ContentType)content.Type, lstFlavors, lstSections); // If a editor/author wants to edit a publish content, it should be Send To Verify. if (content.Status == ContentStatus.Published && RolePermissionService.CanCreate()) { contentManagerService.SendToVerify(content.Id, Convert.ToInt32(Membership.GetUser().ProviderUserKey)); } } }