public ActionResult Index(int id) { var producer = Producers.GetByID(id); var groups = Groups.GetRelatedGroupsByProducer(id); var producerDetail = Mapper.Map <ViewProducer>(producer); var model = new ProducerSettings { ProducerDetails = producerDetail, ProductGroups = groups }; ViewBag.Title = producer.TitleEn + " (" + producer.Title + ") "; return(View(model)); }
public ActionResult Edit(int?id) { EditProducer editProducer; if (id.HasValue) { editProducer = Mapper.Map <EditProducer>(Producers.GetByID(id.Value)); editProducer.Groups = ProducerGroups.GetByProducerID(editProducer.ID).Select(item => item.GroupID).ToList(); editProducer.Text = HttpUtility.HtmlDecode(editProducer.Text); } else { editProducer = new EditProducer(); } return(View(editProducer)); }
private static string[] GetDefaultKeys(EditProduct editProduct) { var producer = Producers.GetByID(editProduct.ProducerID); List <Group> grps = Groups.GetByIDs(editProduct.Groups); var titleFa = editProduct.Title.Split(' '); var titleEn = editProduct.Title_En.Split(' '); var producerFa = producer.Title.Split(' '); var producerEn = producer.TitleEn.Split(' '); //var groupFa = grps.Select(item => item.Title).ToArray(); //var groupEn = grps.Select(item => item.TitleEn).ToArray(); string[] defaultKeys = titleFa.Union(titleEn) .Union(producerFa) .Union(producerEn) .ToArray <string>(); return(defaultKeys); }