public async Task <IActionResult> PutUserInfoItem(Guid id, UserInfoItem userInfoItem)
        {
            if (id != userInfoItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(userInfoItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserInfoItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Location_IdLocation,username,passwords")] UserInfo userInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userInfo));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,CreateTime")] UserInfoDto userInfoDto)
        {
            if (ModelState.IsValid)
            {
                userInfoDto.Id = Guid.NewGuid();
                _context.Add(userInfoDto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userInfoDto));
        }
 public async Task AddAsync(UserInfo entity)
 {
     _context.UserInfos.Add(entity);
     await _context.SaveChangesAsync();
 }