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

            if (single == null)
            {
                return(NotFound());
            }
            ObjectCopy.Copy <kc_supplier>(single, value, new string[] { "name", "address", "linkMan", "tel", "linkManTitle", "linkManTel", "faxNo", "remark", "city" });
            //更新字段内容
            single.UpdatedAt = DateTime.Now;
            if (User.Identity is ClaimsIdentity identity)
            {
                single.CreatedBy = identity.Name ?? "admin";
            }
            _kcSupplierRpt.Commit();
            return(new NoContentResult());
        }