예제 #1
0
        public Result PostFlowCardType([FromBody] FlowCardType flowCardType)
        {
            flowCardType.CreateUserId   = Request.GetIdentityInformation();
            flowCardType.MarkedDateTime = DateTime.Now;
            ServerConfig.ApiDb.Execute(
                "INSERT INTO flowcard_type (`CreateUserId`, `MarkedDateTime`, `MarkedDelete`, `ModifyId`, `TypeName`, `Abbre`) " +
                "VALUES (@CreateUserId, @MarkedDateTime, @MarkedDelete, @ModifyId, @TypeName, @Abbre);",
                flowCardType);

            return(Result.GenError <Result>(Error.Success));
        }
예제 #2
0
        public Result PutFlowCardType([FromRoute] int id, [FromBody] FlowCardType flowCardType)
        {
            var cnt =
                ServerConfig.ApiDb.Query <int>("SELECT COUNT(1) FROM `flowcard_type` WHERE Id = @id AND `MarkedDelete` = 0;", new { id }).FirstOrDefault();

            if (cnt == 0)
            {
                return(Result.GenError <Result>(Error.FlowCardTypeNotExist));
            }

            flowCardType.Id             = id;
            flowCardType.CreateUserId   = Request.GetIdentityInformation();
            flowCardType.MarkedDateTime = DateTime.Now;
            ServerConfig.ApiDb.Execute(
                "UPDATE flowcard_type SET `CreateUserId` = @CreateUserId, `MarkedDateTime` = @MarkedDateTime, `MarkedDelete` = @MarkedDelete, " +
                "`ModifyId` = @ModifyId, `TypeName` = @TypeName, `Abbre` = @Abbre WHERE `Id` = @Id;", flowCardType);

            return(Result.GenError <Result>(Error.Success));
        }