コード例 #1
0
 public async Task <IActionResult> Post([FromBody] set_allhouse_price value)
 {
     value.CreatedAt = DateTime.Now;
     value.UpdatedAt = DateTime.Now;
     value.IsValid   = true;
     if (User.Identity is ClaimsIdentity identity)
     {
         value.CreatedBy = identity.Name ?? "admin";
     }
     _setAllhousePriceRpt.Add(value);
     _setAllhousePriceRpt.Commit();
     return(new OkObjectResult(value));
 }
コード例 #2
0
        public async Task <IActionResult> Put(int id, [FromBody] set_allhouse_price value)
        {
            var single = _setAllhousePriceRpt.GetSingle(id);

            if (single == null)
            {
                return(NotFound());
            }
            ObjectCopy.Copy <set_allhouse_price>(single, value, new string[] { "name", "halfPriceHours", "allPriceHours", "leaveTime", "addFeeHours", "addAllDay", "addAllHours", "remark" });
            //更新字段内容
            single.UpdatedAt = DateTime.Now;
            if (User.Identity is ClaimsIdentity identity)
            {
                single.CreatedBy = identity.Name ?? "admin";
            }
            _setAllhousePriceRpt.Commit();
            return(new NoContentResult());
        }