public IActionResult Post([FromBody] set_house_type value) { value.CreatedAt = DateTime.Now; value.UpdatedAt = DateTime.Now; value.IsValid = true; if (User.Identity is ClaimsIdentity identity) { value.CreatedBy = identity.Name ?? "test"; } _setHouseTypeRpt.Add(value); _setHouseTypeRpt.Commit(); return(new OkObjectResult(value)); }
public async Task <IActionResult> Put(int id, [FromBody] set_house_type value) { var single = _setHouseTypeRpt.GetSingle(id); if (single == null) { return(NotFound()); } //更新字段内容 single.UpdatedAt = DateTime.Now; single.AddMaxPrice = value.AddMaxPrice; single.AddPrice = value.AddPrice; single.AllPrice = value.AllPrice; single.PreReceiveFee = value.PreReceiveFee; single.Remark = value.Remark; single.StartPrice = value.StartPrice; single.TypeName = value.TypeName; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _setHouseTypeRpt.Commit(); return(new NoContentResult()); }