public Sys_DynamicColumnModel Put(Sys_DynamicColumnModel model) { var Sys_DynamicColumn = new Sys_DynamicColumnEntity { ID = model.ID, ColumnName = model.ColumnName, Code = model.Code, Status = model.Status, DataType = model.DataType, Length = model.Length, TableName = model.TableName, Comment = model.Comment }; var service = new Sys_DynamicColumnServices(); if (model.ID != Guid.Empty) { Sys_DynamicColumn.ID = model.ID; service.Edit <Sys_DynamicColumnEntity>(Sys_DynamicColumn); } else { service.Add(Sys_DynamicColumn); model.ID = Sys_DynamicColumn.ID; } return(model); }
public string Post([Bind] Sys_DynamicColumnModel model) { var success = string.Empty; if (model.Length != null) { if (model.DataType == "Decimal") { model.DataType = model.DataType + "(" + model.Length + ",0)"; } else { model.DataType = model.DataType + "(" + model.Length + ")"; } } else { model.DataType = model.DataType; } var listDynamicColumnModel = new List <Sys_DynamicColumnModel> { model }; var entity = listDynamicColumnModel.ToList().Translate <Sys_DynamicColumnEntity>(); var service = new Sys_DynamicColumnServices(); if (model.ID != Guid.Empty) { entity[0].ID = model.ID; success = service.Edit <Sys_DynamicColumnEntity>(entity[0]) + ",0"; } else { success = service.Add <Sys_DynamicColumnEntity>(entity[0]) + ",0"; model.ID = entity[0].ID; } return(success); }