public async Task <IActionResult> Post([FromBody] set_group value) { value.CreatedAt = DateTime.Now; value.UpdatedAt = DateTime.Now; value.IsValid = true; if (User.Identity is ClaimsIdentity identity) { value.CreatedBy = identity.Name ?? "test"; } _setGroupRpt.Add(value); _setGroupRpt.Commit(); return(new OkObjectResult(value)); }
public async Task <IActionResult> Put(int id, [FromBody] set_group value) { var single = _setGroupRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_group>(single, value, "address", "contractDate1", "contractDate2", "contractNo", "coupons", "linkMan", "mobile", "name", "remark"); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _setGroupRpt.Commit(); return(new NoContentResult()); }