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