public ActionResult Zusatzinfos(string value, string description) { string email = User.Identity.Name; using (MeetsEntities cont = new MeetsEntities()) { //Member Id holen und auf member_id in Memberproperties Speichern int memValId = (from m in cont.Members where m.email == email select m.id).FirstOrDefault(); //instanzen erstellen mit variablen von Propertytype und speichern Propertytype pt = new Propertytype(); pt.created = DateTime.Now; pt.description = description; cont.Propertytypes.Add(pt); cont.SaveChanges(); //instanzen erstellen mit variablen von Zwischentabelle Memberproperties und speichern Memberproperty mp = new Memberproperty(); mp.created = DateTime.Now; mp.member_id = memValId; mp.propertytype_id = pt.id; mp.val = value; cont.Memberproperties.Add(mp); cont.SaveChanges(); return(RedirectToAction("Zusatzinfos")); } }
public ActionResult Zusatzinfos() { string defaultUserEmail = User.Identity.Name; using (MeetsEntities cont = new MeetsEntities()) { //Entitätssumme Member to List laden über Angemeldete E-Mail List <Member> memVal = (from m in cont.Members where m.email == defaultUserEmail select m).ToList(); //Überprüfen ob Entitätsmenge Default Member vorhanden if (memVal.Count != 0) { //Entitätsmenge aus Memberproperties als Liste für View List <Memberproperty> memProp = (from mp in cont.Memberproperties where mp.member_id == mp.Member.id select mp).ToList(); //Überprüfung ob in Memberproperties Einträge existieren if (memProp.Count != 0) { //Mit ViewBag Liste dem View übergeben ViewBag.valMemProp = memProp; //neue Liste vom Type Propertytype List <Propertytype> fertig = new List <Propertytype>(); //durch Liste interieren und Daten auf neue Liste speichern foreach (var item in memProp) { //Instanz erzeugen mit pointer pt als Variable Propertytype pt = new Propertytype(); //Hole bei jedem Durchgang die Entitäsmenge um die neue Liste zu befüllen Propertytype propType = (from ptt in cont.Propertytypes where ptt.id == item.propertytype_id select ptt).FirstOrDefault(); pt.created = propType.created; pt.description = propType.description; pt.id = propType.id; //pt-Sammlung in Liste ablegen fertig.Add(pt); } cont.SaveChanges(); //wenn Liste fertig Inhalt hat if (fertig.Count != 0) { //Mit VieBag dem View übergeben ViewBag.PropType = fertig; } } return(View(memVal)); } //ViewBag.BindingError = "Keine Zusatz Daten vorhanden "; return(View()); } }
//Selecting a Dropdown control public static void SelectDropDown(string element, string value, Propertytype elementtype) { if (elementtype == Propertytype.Id) { new SelectElement(PropertiesCollection.driver.FindElement(By.Id(element))).SelectByText(value); } if (elementtype == Propertytype.Name) { new SelectElement(PropertiesCollection.driver.FindElement(By.Name(element))).SelectByText(value); } }
//Click in to Button, Checkbox , Optionbox etc public static void Click(string element, Propertytype elementtype) { if (elementtype == Propertytype.Id) { PropertiesCollection.driver.FindElement(By.Id(element)).Click(); } if (elementtype == Propertytype.Name) { PropertiesCollection.driver.FindElement(By.Name(element)).Click(); } }
//Enter Text public static void EnterText(string element, string value, Propertytype elementtype) { if (elementtype == Propertytype.Id) { PropertiesCollection.driver.FindElement(By.Id(element)).SendKeys(value); } if (elementtype == Propertytype.Name) { PropertiesCollection.driver.FindElement(By.Name(element)).SendKeys(value); } }
public static string GetTextFromDDL(string element, Propertytype elementtype) { if (elementtype == Propertytype.Id) { return(new SelectElement(PropertiesCollection.driver.FindElement(By.Id(element))).AllSelectedOptions.SingleOrDefault().Text); } if (elementtype == Propertytype.Name) { return(new SelectElement(PropertiesCollection.driver.FindElement(By.Name(element))).AllSelectedOptions.SingleOrDefault().Text); } else { return(string.Empty); } }
public static string GetText(string element, Propertytype elementtype) { if (elementtype == Propertytype.Id) { return(PropertiesCollection.driver.FindElement(By.Id(element)).GetAttribute("Value")); } if (elementtype == Propertytype.Name) { return(PropertiesCollection.driver.FindElement(By.Name(element)).GetAttribute("Value")); } else { return(string.Empty); } }