// GET: DataTableImportMappings/Create
        public ActionResult Create()
        {
            DataTableImportMapping dataTableImportMapping = new DataTableImportMapping();

            //set default value
            return(View(dataTableImportMapping));
        }
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            DataTableImportMapping dataTableImportMapping = _dataTableImportMappingService.Find(id);

            _dataTableImportMappingService.Delete(dataTableImportMapping);
            _unitOfWork.SaveChanges();
            if (Request.IsAjaxRequest())
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            DisplaySuccessMessage("Has delete a DataTableImportMapping record");
            return(RedirectToAction("Index"));
        }
        // GET: DataTableImportMappings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DataTableImportMapping dataTableImportMapping = _dataTableImportMappingService.Find(id);

            if (dataTableImportMapping == null)
            {
                return(HttpNotFound());
            }
            return(View(dataTableImportMapping));
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,EntitySetName,FieldName,TypeName,SourceFieldName,IsEnabled,RegularExpression")] DataTableImportMapping dataTableImportMapping)
        {
            if (ModelState.IsValid)
            {
                _dataTableImportMappingService.Insert(dataTableImportMapping);
                _unitOfWork.SaveChanges();
                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }
                DisplaySuccessMessage("Has append a DataTableImportMapping record");
                return(RedirectToAction("Index"));
            }

            if (Request.IsAjaxRequest())
            {
                var modelStateErrors = String.Join("", this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors.Select(n => n.ErrorMessage)));
                return(Json(new { success = false, err = modelStateErrors }, JsonRequestBehavior.AllowGet));
            }
            DisplayErrorMessage();
            return(View(dataTableImportMapping));
        }