public NumericEntryQuantityQuestionInputView(QuantityQuestion question, SurveyPageAppearance appearance) : base(appearance) { _question = question; var stackLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Spacing = 10 }; _entry = BuildValueEntry (question); stackLayout.Children.Add (_entry); if (question.HasUnitOptions) { _picker = BuildUnitPicker (question); stackLayout.Children.Add (_picker); } SetUIFromResponse (); // set event handlers AFTER populating _question.PropertyChanged += Question_PropertyChanged; _entry.TextChanged += Entry_TextChanged; if (_picker != null) { _picker.PropertyChanged += Picker_PropertyChanged; } Content = stackLayout; }
public FreeTextQuestionInputView(FreeTextQuestion question, SurveyPageAppearance appearance) : base(appearance) { var entry = new GBEntry (); entry.HorizontalOptions = LayoutOptions.FillAndExpand; entry.VerticalOptions = LayoutOptions.FillAndExpand; entry.Placeholder = question.Text; entry.BindingContext = question; entry.SetBinding (Entry.TextProperty, new Binding ("Response", BindingMode.TwoWay)); Content = entry; }
GBEntry BuildValueEntry(QuantityQuestion question) { var entry = new GBEntry { Placeholder = question.Text, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric }; return entry; }
public PartialViewResult Create(CreateGBEntryModel entry) { if (ModelState.IsValid) { GBEntry e = new GBEntry() { UserId = entry.UserId, content = entry.Content, CreationDate = entry.created, WriterId = entry.WriterId }; db.GuestbookEntrys.Add(e); db.SaveChanges(); return PartialView("GBSuccess"); } return PartialView(entry); }
public ActionResult Create(GBEntry gbentry) { if (ModelState.IsValid) { Guid id = (Guid)Membership.GetUser().ProviderUserKey; User user = db.Users.Single(u => u.UserId == id); user.Guestbook.Add(gbentry); db.Entry(user).State = EntityState.Modified; //db.GuestbookEntrys.Add(gbentry); db.SaveChanges(); return RedirectToAction("Index"); } return View(gbentry); }
public ActionResult Edit(GBEntry gbentry) { if (ModelState.IsValid) { db.Entry(gbentry).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(gbentry); }
public ActionResult Edit(GBEntry gbentry) { if (ModelState.IsValid) { db.Entry(gbentry).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.WriterId = new SelectList(db.Users, "UserId", "Username", gbentry.WriterId); return View(gbentry); }