public async Task <IActionResult> Edit(int id, [Bind("IdnumberTemplate,FkNumber,FkTemplate,Priority,Active,FkRoutingGroup")] NumberTemplate numberTemplate) { if (id != numberTemplate.IdnumberTemplate) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(numberTemplate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NumberTemplateExists(numberTemplate.IdnumberTemplate)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(numberTemplate)); }
public void ShouldValidateEmptyString() { var emptyNumber = new NumberTemplate() { Number = "" }; var factory = new NumberFieldFactory(); var actual = factory.IsValidForField(JObject.FromObject(emptyNumber)); Assert.IsTrue(actual); var filledNumber = new NumberTemplate() { Number = "1234566789021354" }; var actual2 = factory.IsValidForField(JObject.FromObject(filledNumber)); Assert.IsTrue(actual2); var worngNumber = new NumberTemplate() { Number = "123456678adsassd9021354" }; var actual3 = factory.IsValidForField(JObject.FromObject(worngNumber)); Assert.IsFalse(actual3); }
public virtual void Write(ICodeFragment fragment, IOutputCache output) { NumberTemplate template = (NumberTemplate)fragment; output.Add(template.LongValue?.ToString(CultureInfo.InvariantCulture) ?? template.DoubleValue?.ToString(CultureInfo.InvariantCulture) ?? template.FloatValue?.ToString(CultureInfo.InvariantCulture)); }
public async Task <IActionResult> Create([Bind("IdnumberTemplate,FkNumber,FkTemplate,Priority,Active,FkRoutingGroup")] NumberTemplate numberTemplate) { if (ModelState.IsValid) { _context.Add(numberTemplate); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(numberTemplate)); }
public void ShouldValidateEmptyString() { var dateTimeTemplate = new DateTimeAndDateTemplate() { DateTimeString = "" }; var factory = new DateTimeFieldFactory(); var actual = factory.IsValidForField(JObject.FromObject(dateTimeTemplate)); var numberField = new NumberTemplate() { Number = "" }; var actual2 = factory.IsValidForField(JObject.FromObject(numberField)); Assert.IsTrue(actual); Assert.IsFalse(actual2); }
public virtual void Write(ICodeFragment fragment, IOutputCache output) { NumberTemplate template = (NumberTemplate)fragment; output.Add(template.Value.ToString()); }