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