public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name")] LField lField) { if (id != lField.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lField); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LFieldExists(lField.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lField)); }
public async Task <IActionResult> Create([Bind("Id,Name")] LField lField) { if (ModelState.IsValid) { lField.Id = Guid.NewGuid(); _context.Add(lField); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lField)); }
// IWebElement protected override void InternalRender(HtmlTextWriter AWriter) { AWriter.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox"); AWriter.AddAttribute(HtmlTextWriterAttribute.Name, ID); string LHint = GetHint(); if (LHint != String.Empty) { AWriter.AddAttribute(HtmlTextWriterAttribute.Title, LHint, true); } bool LActive = IsFieldActive(); DAE.Client.DataField LField; if (LActive) { LField = Source.DataView.Fields[ColumnName]; } else { LField = null; } bool LHasValue = LActive && LField.HasValue(); if (LActive) { if (LHasValue && LField.AsBoolean) { AWriter.AddAttribute(HtmlTextWriterAttribute.Checked, null); } if (!ReadOnly) { if (LHasValue) { AWriter.AddAttribute(HtmlTextWriterAttribute.Class, "checkbox"); } else { AWriter.AddAttribute(HtmlTextWriterAttribute.Onchange, String.Format("NotNull(this, '{0}', 'checkbox')", FHasValueID)); AWriter.AddAttribute(HtmlTextWriterAttribute.Class, "checkboxnull"); } } } if (ReadOnly || !LActive) { AWriter.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); AWriter.AddAttribute(HtmlTextWriterAttribute.Class, "readonlycheckbox"); } // TODO: Reenable auto-update when there is a way to reset the focused control when posting (really annoying right now when turned on) // if (FAutoUpdate && !ReadOnly) // AWriter.AddAttribute(HtmlTextWriterAttribute.Onchange, "Submit('" + (string)Session["DefaultPage"] + "',event)"); AWriter.AddAttribute(HtmlTextWriterAttribute.Value, "true"); AWriter.RenderBeginTag(HtmlTextWriterTag.Input); AWriter.Write(" "); AWriter.Write(HttpUtility.HtmlEncode(Session.RemoveAccellerator(Title))); AWriter.Write(" "); AWriter.RenderEndTag(); if (!LHasValue && !ReadOnly) { AWriter.AddAttribute(HtmlTextWriterAttribute.Name, FHasValueID); AWriter.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); AWriter.AddAttribute(HtmlTextWriterAttribute.Value, "false"); AWriter.RenderBeginTag(HtmlTextWriterTag.Input); AWriter.RenderEndTag(); } }