Example #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="id"></param>
        /// <param name="InFor"></param>
        /// <returns></returns>
        public PersonInfor Update(string id, PersonInfor InFor)
        {
            var         guid        = new Guid(id);
            PersonInfor information = DemoContext.PersonInfor.Where(p => p.Id == guid).FirstOrDefault();

            information.Name    = InFor.Name;
            information.Age     = InFor.Age;
            information.Sex     = InFor.Sex;
            information.Address = InFor.Address;
            DemoContext.SaveChanges();
            return(InFor);
        }
Example #2
0
        public IActionResult update(string id, PersonInfor information)
        {
            JsonResponse resp = null;
            var          data = Factory.Update(id, information);

            if (data == null)
            {
                resp = new JsonResponse(300, "修改失败", null);
            }
            else
            {
                resp = new JsonResponse(200, "修改成功", data);
            }
            return(Ok(resp));
        }