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 void NUnit_DynamicColumn_Domain_Edit()
 {
     Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
     var model = new Sys_DynamicColumn
     {
         Id = 67,
         Code = "1",
         ColumnName = "test ",
     };
     var result = service.Edit<Sys_DynamicColumn>(model);
  //   NUnit.Framework.Assert.IsTrue(result);
     if (result == ActionStatus.EditSucceed.ToString())
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id
                 + " | " + model.Code
                 + " | " + model.ColumnName
                 );
     }
 }
Beispiel #3
0
        public void NUnit_DynamicColumn_Domain_Edit()
        {
            Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
            var model = new Sys_DynamicColumn
            {
                Id         = 67,
                Code       = "1",
                ColumnName = "test ",
            };
            var result = service.Edit <Sys_DynamicColumn>(model);

            //   NUnit.Framework.Assert.IsTrue(result);
            if (result == ActionStatus.EditSucceed.ToString())
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id
                                  + " | " + model.Code
                                  + " | " + model.ColumnName
                                  );
            }
        }
        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);
        }