Ejemplo 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());
        }
Ejemplo 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.失败);
        }