public async Task <ActionResult> DeleteConfirmed(int id) { BaseFieldType baseFieldType = await db.BaseFieldTypes.FindAsync(id); db.BaseFieldTypes.Remove(baseFieldType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "IdContractFieldType,Name,Type")] BaseFieldType baseFieldType) { if (ModelState.IsValid) { db.Entry(baseFieldType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.Type = new SelectList(db.Types, "ID", "Name", baseFieldType.Type); return(View(baseFieldType)); }
private void ExecuteTest(PropertyDefinition definition, string expectedTemplate) { // Arrange var generator = new Generator(); var template = new BaseFieldType(generator, definition); // Act var actualTemplate = template.ToString(); // Assert Assert.NotNull(actualTemplate); Assert.Equal(expectedTemplate, actualTemplate); }
// GET: BaseFieldTypes/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaseFieldType baseFieldType = await db.BaseFieldTypes.FindAsync(id); if (baseFieldType == null) { return(HttpNotFound()); } return(View(baseFieldType)); }
// GET: BaseFieldTypes/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaseFieldType baseFieldType = await db.BaseFieldTypes.FindAsync(id); if (baseFieldType == null) { return(HttpNotFound()); } ViewBag.Type = new SelectList(db.Types, "ID", "Name", baseFieldType.Type); return(View(baseFieldType)); }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { BaseFieldType field = (BaseFieldType)value; if (field == null) { return; } writer.WriteStartObject(); WriteField(writer, value, serializer); if (!string.IsNullOrEmpty(field.IndexName)) { writer.WritePropertyName("index_name"); writer.WriteValue(field.IndexName); } if (field.Store != DefaultConstants.Default_StoreType) { writer.WritePropertyName("store"); writer.WriteValue(field.Store.ToString().ToLower()); } if (field.IndexType != DefaultConstants.Default_IndexType) { writer.WritePropertyName("index"); writer.WriteValue(field.IndexType.ToString().ToLower()); } if (Math.Abs(field.Boost - DefaultConstants.Default_Boost) > 0) { writer.WritePropertyName("boost"); writer.WriteValue(field.Boost); } if (field.IncludeInAll != DefaultConstants.Default_IncludeInAll) { writer.WritePropertyName("include_in_all"); writer.WriteValue(field.IncludeInAll); } writer.WriteEndObject(); }