Esempio n. 1
0
 public async Task <IActionResult> Post([FromBody] kc_storeexc value)
 {
     value.CreatedAt = DateTime.Now;
     value.UpdatedAt = DateTime.Now;
     value.IsValid   = true;
     if (User.Identity is ClaimsIdentity identity)
     {
         value.CreatedBy = identity.Name ?? "test";
     }
     _kcStoreexcRpt.Add(value);
     _kcStoreexcRpt.Commit();
     return(new OkObjectResult(value));
 }
Esempio n. 2
0
        public async Task <IActionResult> Put(int id, [FromBody] kc_storeexc value)
        {
            var single = _kcStoreexcRpt.GetSingle(id);

            if (single == null)
            {
                return(NotFound());
            }
            //更新字段内容
            single.UpdatedAt = DateTime.Now;
            if (User.Identity is ClaimsIdentity identity)
            {
                single.CreatedBy = identity.Name ?? "test";
            }
            _kcStoreexcRpt.Commit();
            return(new NoContentResult());
        }