Esempio n. 1
0
        async public Task <ActionResult> Edit([FromQuery] int Id)
        {
            Tb_alltypeInfo item = await Tb_alltype.GetItemAsync(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Esempio n. 2
0
        async public Task <APIReturn> _Edit([FromQuery] int Id, [FromForm] bool TestFieldBool1111, [FromForm] bool TestFieldBoolNullable, [FromForm] byte?TestFieldByte, [FromForm] byte?TestFieldByteNullable, [FromForm] byte[] TestFieldBytes, [FromForm] DateTime?TestFieldDateTime, [FromForm] DateTime?TestFieldDateTimeNullable, [FromForm] DateTimeOffset?TestFieldDateTimeNullableOffset, [FromForm] DateTimeOffset?TestFieldDateTimeOffset, [FromForm] decimal?TestFieldDecimal, [FromForm] decimal?TestFieldDecimalNullable, [FromForm] double?TestFieldDouble, [FromForm] double?TestFieldDoubleNullable, [FromForm] int?TestFieldEnum1, [FromForm] int?TestFieldEnum1Nullable, [FromForm] long?TestFieldEnum2, [FromForm] long?TestFieldEnum2Nullable, [FromForm] float?TestFieldFloat, [FromForm] float?TestFieldFloatNullable, [FromForm] Guid?TestFieldGuid, [FromForm] Guid?TestFieldGuidNullable, [FromForm] int?TestFieldInt, [FromForm] int?TestFieldIntNullable, [FromForm] long?TestFieldLong, [FromForm] byte?TestFieldSByte, [FromForm] byte?TestFieldSByteNullable, [FromForm] short?TestFieldShort, [FromForm] short?TestFieldShortNullable, [FromForm] string TestFieldString, [FromForm] TimeSpan?TestFieldTimeSpan, [FromForm] TimeSpan?TestFieldTimeSpanNullable, [FromForm] int?TestFieldUInt, [FromForm] int?TestFieldUIntNullable, [FromForm] long?TestFieldULong, [FromForm] long?TestFieldULongNullable, [FromForm] short?TestFieldUShort, [FromForm] short?TestFieldUShortNullable, [FromForm] long?TestFielLongNullable)
        {
            Tb_alltypeInfo item = await Tb_alltype.GetItemAsync(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.TestFieldBool1111               = TestFieldBool1111;
            item.TestFieldBoolNullable           = TestFieldBoolNullable;
            item.TestFieldByte                   = TestFieldByte;
            item.TestFieldByteNullable           = TestFieldByteNullable;
            item.TestFieldBytes                  = TestFieldBytes;
            item.TestFieldDateTime               = TestFieldDateTime;
            item.TestFieldDateTimeNullable       = TestFieldDateTimeNullable;
            item.TestFieldDateTimeNullableOffset = TestFieldDateTimeNullableOffset;
            item.TestFieldDateTimeOffset         = TestFieldDateTimeOffset;
            item.TestFieldDecimal                = TestFieldDecimal;
            item.TestFieldDecimalNullable        = TestFieldDecimalNullable;
            item.TestFieldDouble                 = TestFieldDouble;
            item.TestFieldDoubleNullable         = TestFieldDoubleNullable;
            item.TestFieldEnum1                  = TestFieldEnum1;
            item.TestFieldEnum1Nullable          = TestFieldEnum1Nullable;
            item.TestFieldEnum2                  = TestFieldEnum2;
            item.TestFieldEnum2Nullable          = TestFieldEnum2Nullable;
            item.TestFieldFloat                  = TestFieldFloat;
            item.TestFieldFloatNullable          = TestFieldFloatNullable;
            item.TestFieldGuid                   = TestFieldGuid;
            item.TestFieldGuidNullable           = TestFieldGuidNullable;
            item.TestFieldInt              = TestFieldInt;
            item.TestFieldIntNullable      = TestFieldIntNullable;
            item.TestFieldLong             = TestFieldLong;
            item.TestFieldSByte            = TestFieldSByte;
            item.TestFieldSByteNullable    = TestFieldSByteNullable;
            item.TestFieldShort            = TestFieldShort;
            item.TestFieldShortNullable    = TestFieldShortNullable;
            item.TestFieldString           = TestFieldString;
            item.TestFieldTimeSpan         = TestFieldTimeSpan;
            item.TestFieldTimeSpanNullable = TestFieldTimeSpanNullable;
            item.TestFieldUInt             = TestFieldUInt;
            item.TestFieldUIntNullable     = TestFieldUIntNullable;
            item.TestFieldULong            = TestFieldULong;
            item.TestFieldULongNullable    = TestFieldULongNullable;
            item.TestFieldUShort           = TestFieldUShort;
            item.TestFieldUShortNullable   = TestFieldUShortNullable;
            item.TestFielLongNullable      = TestFielLongNullable;
            int affrows = await Tb_alltype.UpdateAsync(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Esempio n. 3
0
        async public Task <APIReturn> _Del([FromForm] int[] id)
        {
            var dels = new List <object>();

            foreach (int id2 in id)
            {
                dels.Add(await Tb_alltype.DeleteAsync(id2));
            }
            if (dels.Count > 0)
            {
                return(APIReturn.成功.SetMessage($"删除成功,影响行数:{dels.Count}").SetData("dels", dels));
            }
            return(APIReturn.失败);
        }
Esempio n. 4
0
        async public Task <APIReturn> _Add([FromForm] bool TestFieldBool1111, [FromForm] bool TestFieldBoolNullable, [FromForm] byte?TestFieldByte, [FromForm] byte?TestFieldByteNullable, [FromForm] byte[] TestFieldBytes, [FromForm] DateTime?TestFieldDateTime, [FromForm] DateTime?TestFieldDateTimeNullable, [FromForm] DateTimeOffset?TestFieldDateTimeNullableOffset, [FromForm] DateTimeOffset?TestFieldDateTimeOffset, [FromForm] decimal?TestFieldDecimal, [FromForm] decimal?TestFieldDecimalNullable, [FromForm] double?TestFieldDouble, [FromForm] double?TestFieldDoubleNullable, [FromForm] int?TestFieldEnum1, [FromForm] int?TestFieldEnum1Nullable, [FromForm] long?TestFieldEnum2, [FromForm] long?TestFieldEnum2Nullable, [FromForm] float?TestFieldFloat, [FromForm] float?TestFieldFloatNullable, [FromForm] Guid?TestFieldGuid, [FromForm] Guid?TestFieldGuidNullable, [FromForm] int?TestFieldInt, [FromForm] int?TestFieldIntNullable, [FromForm] long?TestFieldLong, [FromForm] byte?TestFieldSByte, [FromForm] byte?TestFieldSByteNullable, [FromForm] short?TestFieldShort, [FromForm] short?TestFieldShortNullable, [FromForm] string TestFieldString, [FromForm] TimeSpan?TestFieldTimeSpan, [FromForm] TimeSpan?TestFieldTimeSpanNullable, [FromForm] int?TestFieldUInt, [FromForm] int?TestFieldUIntNullable, [FromForm] long?TestFieldULong, [FromForm] long?TestFieldULongNullable, [FromForm] short?TestFieldUShort, [FromForm] short?TestFieldUShortNullable, [FromForm] long?TestFielLongNullable)
        {
            Tb_alltypeInfo item = new Tb_alltypeInfo();

            item.TestFieldBool1111               = TestFieldBool1111;
            item.TestFieldBoolNullable           = TestFieldBoolNullable;
            item.TestFieldByte                   = TestFieldByte;
            item.TestFieldByteNullable           = TestFieldByteNullable;
            item.TestFieldBytes                  = TestFieldBytes;
            item.TestFieldDateTime               = TestFieldDateTime;
            item.TestFieldDateTimeNullable       = TestFieldDateTimeNullable;
            item.TestFieldDateTimeNullableOffset = TestFieldDateTimeNullableOffset;
            item.TestFieldDateTimeOffset         = TestFieldDateTimeOffset;
            item.TestFieldDecimal                = TestFieldDecimal;
            item.TestFieldDecimalNullable        = TestFieldDecimalNullable;
            item.TestFieldDouble                 = TestFieldDouble;
            item.TestFieldDoubleNullable         = TestFieldDoubleNullable;
            item.TestFieldEnum1                  = TestFieldEnum1;
            item.TestFieldEnum1Nullable          = TestFieldEnum1Nullable;
            item.TestFieldEnum2                  = TestFieldEnum2;
            item.TestFieldEnum2Nullable          = TestFieldEnum2Nullable;
            item.TestFieldFloat                  = TestFieldFloat;
            item.TestFieldFloatNullable          = TestFieldFloatNullable;
            item.TestFieldGuid                   = TestFieldGuid;
            item.TestFieldGuidNullable           = TestFieldGuidNullable;
            item.TestFieldInt              = TestFieldInt;
            item.TestFieldIntNullable      = TestFieldIntNullable;
            item.TestFieldLong             = TestFieldLong;
            item.TestFieldSByte            = TestFieldSByte;
            item.TestFieldSByteNullable    = TestFieldSByteNullable;
            item.TestFieldShort            = TestFieldShort;
            item.TestFieldShortNullable    = TestFieldShortNullable;
            item.TestFieldString           = TestFieldString;
            item.TestFieldTimeSpan         = TestFieldTimeSpan;
            item.TestFieldTimeSpanNullable = TestFieldTimeSpanNullable;
            item.TestFieldUInt             = TestFieldUInt;
            item.TestFieldUIntNullable     = TestFieldUIntNullable;
            item.TestFieldULong            = TestFieldULong;
            item.TestFieldULongNullable    = TestFieldULongNullable;
            item.TestFieldUShort           = TestFieldUShort;
            item.TestFieldUShortNullable   = TestFieldUShortNullable;
            item.TestFielLongNullable      = TestFielLongNullable;
            item = await Tb_alltype.InsertAsync(item);

            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Esempio n. 5
0
 internal static void RemoveCache(Tb_alltype item) => RemoveCache(item == null ? null : new[] { item });