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