示例#1
0
        public async Task <JsonResult> Post([FromBody] SysUser sysUser)
        {
            var user = await dbContext.AddAsync <SysUser>(sysUser);

            if (user.State.Equals(EntityState.Added))
            {
                return(new JsonResult(new RespResult
                {
                    Code = (int)RespState.SUCCESS,
                    Msg = RespState.SUCCESS.ToString(),
                    Data = user.Entity
                }));
            }
            return(new JsonResult(new RespResult
            {
                Code = (int)RespState.ERROR,
                Msg = RespState.ERROR.ToString()
            }));
        }