Editor Generator Error
Editor Generator Error
![dpanscik](https://datatables.net/forums/uploads/userpics/884/n85SE35OYWOOR.jpg)
I used the Generator at; https://editor.datatables.net/generator/
This tool is super helpful in understanding how editor functions.
The Controller generated has a red squiggly error like a "using" needs to be sighted or a dll needs to be referenced. Anyone know what I need to add here?
The red squiggly is line 23 Properties (not sure why this website isnt properly displaying this code sample inside of the three ticks.
/*
* Controller for DB table OnCall
* Created by http://editor.datatables.net/generator
*/
using System;
using System.Collections.Generic;
using System.Net.Http.Formatting;
using System.Web;
using System.Web.Http;
using DataTables;
using EditorGenerator.Models;
namespace EditorGenerator.Controllers
{
public class OnCallController : ApiController
{
[Route("api/OnCall")]
[HttpGet]
[HttpPost]
public IHttpActionResult OnCall()
{
var request = HttpContext.Current.Request;
LINE 23 >>> var settings = Properties.Settings.Default;
using (var db = new Database(settings.DbType, settings.DbConnection))
{
// The following statement can be removed after the first run
// (i.e. the database table has been created). It is a good idea
// to do this to help improve performance.
db.Sql(@"IF object_id('OnCall', 'U') is null
CREATE TABLE OnCall (
[TableID] int not null identity,
[day] date,
[shop] nvarchar(255),
[name] nvarchar(255),
[phone] nvarchar(255),
[email] nvarchar(255),
PRIMARY KEY( [TableID] )
);");
var response = new Editor(db, "OnCall", "TableID")
.Model<OnCallModel>()
.Field(new Field("day")
.Validator(Validation.DateFormat(Format.DATE_ISO_850))
.GetFormatter(Format.DateSqlToFormat(Format.DATE_ISO_850))
.SetFormatter(Format.DateFormatToSql(Format.DATE_ISO_850))
)
.Process(request)
.Data();
return Json(response);
}
}
}