示例#1
0
 private static LwdzDTO LwdzToDTO(Lwdz lwdz) =>
 new LwdzDTO
 {
     ID   = lwdz.ID,
     Name = lwdz.Name,
     Pwd  = lwdz.Pwd
 };
示例#2
0
        public async Task <ActionResult <LwdzDTO> > PostLwdz(LwdzDTO lwdzDTO)
        {
            var lwdz = new Lwdz
            {
                Name = lwdzDTO.Name,
                Pwd  = lwdzDTO.Pwd
            };

            _context.Lwdzs.Add(lwdz);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLwdz", new { id = lwdz.ID }, LwdzToDTO(lwdz)));
        }