public async Task <IActionResult> Post([FromBody] cw_prefee value) { value.CreatedAt = DateTime.Now; value.IsValid = true; if (User.Identity is ClaimsIdentity identity) { value.CreatedBy = identity.Name ?? "admin"; } _cwPrefeeRpt.Add(value); _cwPrefeeRpt.Commit(); return(new OkObjectResult(value)); }
public async Task <IActionResult> Put(int id, [FromBody] cw_prefee value) { var single = _cwPrefeeRpt.GetSingle(id); if (single == null) { return(NotFound()); } //更新字段内容 if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _cwPrefeeRpt.Commit(); return(new NoContentResult()); }