コード例 #1
0
        public async Task <UserModel> Update(UserModel entity)
        {
            entity.UpdatedDate = DateTime.Now;
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
コード例 #2
0
        public async Task <CompanyModel> Update(CompanyModel entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
コード例 #3
0
        public async Task <ResourceModel> Update(ResourceModel entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
コード例 #4
0
        public async Task <ProjectModel> Update(ProjectModel entity)
        {
            _context.Update(entity);
            await _context.SaveChangesAsync();

            return(entity);
        }
コード例 #5
0
        public async Task <InviteModel> ActivateInvite(Guid inviteId)
        {
            var item = await _context.Invites.FindAsync(inviteId);

            item.IsDeleted   = true;
            item.UpdatedDate = DateTime.UtcNow;
            _context.Update(item);
            await _context.SaveChangesAsync();

            return(item);
        }
コード例 #6
0
        public async Task <UserRegistrationStepModel> SetRegistrationStep(Guid userId, RegistrationStep step, MembershipStatus?status = null)
        {
            var item = await _context.UsersRegistrationStep
                       .Where(x => x.UserId == userId)
                       .FirstOrDefaultAsync();

            var stepExisted = true;

            if (item == null)
            {
                item = new UserRegistrationStepModel {
                    UserId = userId, CreatedDate = DateTime.Now
                };
                stepExisted = false;
            }

            item.Step        = step;
            item.UpdatedDate = DateTime.UtcNow;

            if (status.HasValue)
            {
                item.Status = status.Value;
            }

            if (stepExisted)
            {
                _context.Update(item);
            }
            else
            {
                _context.UsersRegistrationStep.Add(item);
            }
            await _context.SaveChangesAsync();

            return(item);
        }