public DeveloperKey CreateUserKey(int userId) { var uky = GetUserKey(userId); if (uky != null) { disableUky(uky); } var currentDate = DateTime.UtcNow; var ky = new DeveloperKey() { ClientId = createId(), Key = createKey(), isEnabled=true, CreateDate = currentDate, Updatedate = currentDate, UserId=userId }; //ky.User = _user.Single(c => c.UserId == userId); _devrepository.CreateUserKey(ky); _unitOfWork.Commit(); return ky; }
private void disableUky(DeveloperKey uky) { uky.isEnabled = false; uky.Updatedate = DateTime.UtcNow; }