private void populateUser(Entities.User user, IdentityUser identityUser) { user.UserId = identityUser.Id; user.UserName = identityUser.UserName; user.PasswordHash = identityUser.PasswordHash; user.SecurityStamp = identityUser.SecurityStamp; }
private void populateIdentityUser(IdentityUser identityUser, Entities.User user) { identityUser.Id = user.UserId; identityUser.UserName = user.UserName; identityUser.PasswordHash = user.PasswordHash; identityUser.SecurityStamp = user.SecurityStamp; }
public UserEditPresenter(UserEditForm view) { this.user = new User(); this.view = view; this.roles = this.role.GetAll().ToList(); this.view.SaveBtnClick += new EventHandler(SaveBtnClickHandler); this.view.PasswordChange += new EventHandler(PasswordChangedHandler); }
public UserDTO Add(UserDTO userToAdd) { User _user = new User(); _user.Update(userToAdd, uow); uow.UserRepo.Insert(_user); uow.Commit(); return DTOService.ToDTO<User, UserDTO>(_user); }
private static void CreateNewPhoneNumbers(User destination, UserDTO source) { source.PhoneNumbers.Where(x => x.IsNew()).ToList().ForEach(newPhoneNumber => { var toDomain = new PhoneNumber(); toDomain.Update(newPhoneNumber); destination.PhoneNumbers.Add(toDomain); }); }
public bool Authenticate(User user) { if(UserWasFound(user)) { FormsAuthentication.SetAuthCookie(user.UserName, false); return true; } return false; }
public void Seed() { var account = new User { Email = "*****@*****.**", Name = "Administrator", Password = "******", IsAdmin = true }; PasswordEncryptionService.Encrypt(account); _session.Save(account); }
/// <summary> /// Renders information received from authentication service. /// </summary> public ActionResult Auth(string providerName) { var a = GetClient(providerName).GetUserInfo(Request.QueryString); User user = new User { SocialNetworkName = a.ProviderName, Username = a.FirstName, SocialNetworkUserId = a.Id, Token = "", Email = null }; if (_db.Users != null) { var userid = _db.Users.FirstOrDefault(c => c.SocialNetworkUserId == user.SocialNetworkUserId); if (userid == null) { _db.Users.Add(user); _db.SaveChanges(); var roleId = _db.Roles.FirstOrDefault(c => c.Name == "User").Id; user.UserRoles.Add(new UserRole { RoleId = roleId, UserId = user.Id }); } else { userid.SocialNetworkUserId = user.SocialNetworkUserId; userid.SocialNetworkName = user.SocialNetworkName; userid.Username = user.Username; _db.SaveChanges(); } } var userFound = _db.Users.FirstOrDefault(c => c.SocialNetworkUserId == user.SocialNetworkUserId); if (userFound != null) { userFound.Token = GetHashString(user.Id + user.SocialNetworkName + user.SocialNetworkUserId); _db.SaveChanges(); HttpCookie cookie = new HttpCookie("Token"); cookie.Value = userFound.Token; ControllerContext.HttpContext.Response.Cookies.Add(cookie); if (string.IsNullOrEmpty(userFound.Email)) { return(RedirectToAction("Email", "Home")); } return(RedirectToAction("Index", "Home")); } return(RedirectToAction("Login", "Home")); }
public static bool CheckPassword(User user, string password) { SHA512 hashtool = SHA512.Create(); byte[] pass1 = hashtool.ComputeHash(Encoding.UTF8.GetBytes(password)); string pass = BitConverter.ToString(pass1); byte[] pass2 = hashtool.ComputeHash(Encoding.UTF8.GetBytes(pass.Replace("-", "") + user.Salt)); string passFinal = BitConverter.ToString(pass2).Replace("-", ""); if (user.Password.Equals(passFinal)) return true; else return false; }
public void Create(User instance) { try { context.Entry(instance).State = EntityState.Added; } catch (Exception exception) { logger.Trace(exception.StackTrace); throw; } }
public static void Encrypt(User account) { SHA512 hashtool = SHA512.Create(); byte[] pass1 = hashtool.ComputeHash(Encoding.UTF8.GetBytes(account.Password)); string pass = BitConverter.ToString(pass1); byte[] salt1 = hashtool.ComputeHash(Encoding.UTF8.GetBytes(account.Email + account.Name)); string salt = BitConverter.ToString(salt1); byte[] pass2 = hashtool.ComputeHash(Encoding.UTF8.GetBytes(pass.Replace("-", "") + salt.Replace("-", ""))); string passFinal = BitConverter.ToString(pass2); account.Password = passFinal.Replace("-", ""); account.Salt = salt.Replace("-", ""); }
private Entities.User getUser(IdentityUser identityUser) { if (identityUser == null) { return(null); } var user = new Entities.User(); populateUser(user, identityUser); return(user); }
private IdentityUser getIdentityUser(Entities.User user) { if (user == null) { return(null); } var identityUser = new IdentityUser(); populateIdentityUser(identityUser, user); return(identityUser); }
private static void GetAuthUser() { var auth = new AuthenticationForm(); auth.ShowDialog(); if (auth.DialogResult==DialogResult.OK) { AuthUser = auth.presenter.user; } else { System.Environment.Exit(0); } }
public static UserModel ConvertEntityModel(UserEntity user) { if (user == null) { return(null); } return(new UserModel { Username = user.Username, Password = user.Password, State = (int)user.State, }); }
public void AddUser() { Configuration configuration = CreateConfiguration(); var factory = (ISessionFactoryImplementor) configuration.BuildSessionFactory(); using (ISession session = factory.OpenSession()) { var user = new User("name", "*****@*****.**", "login"); user.SetPassword("123"); session.SaveOrUpdate(user); } }
public bool UserWasFound(User user) { User u = user; using (var context = new EFDbContext()) { try { User dbEntry = context.Users.Where(usr => usr.UserName == user.UserName && usr.Password == user.Password && ((usr.Role == User.UserRole.Admin) || usr.Role == User.UserRole.Moderator)).First(); return true; } catch { return false; } } }
private static List<User> AddTenUsers() { List<User> userCollection = new List<User>(); for (int i = 0; i < 9; i++) { User user = new User(); user.Login = "******" + i; user.Password = "******" + i; user.UserInfo = infoCollection[i]; user.UserRole = roleCollection[i]; user.Operator = user; userCollection.Add(user); } return userCollection; }
public async Task <RefreshToken> CreateRefreshToken(string jti, Domain.Entities.User user, bool commit = false) { var refreshToken = new RefreshToken { JwtId = jti, UserId = user.Id, CreatedAt = DateTime.UtcNow, ExpiryDate = DateTime.UtcNow.AddMinutes(Convert.ToDouble(_configuration.GetSection("RefreshTokenExpireMinutes").Value)) }; _uow.Repository <RefreshToken>().Add(refreshToken); if (commit) { await _uow.SaveAsync(); } return(refreshToken); }
public HttpResponseMessage user([FromBody] Domain.Entities.User a) { //return p.findByName(a.Name); //return p.findByEmail(a.email); try { u.AddUserWS(a); var message = Request.CreateErrorResponse(HttpStatusCode.Created, u.ToString()); message.Headers.Location = new Uri(Request.RequestUri + u.ToString()); return(message); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
private static void RefreshExistingPhoneNumbers(User destination, UserDTO source, IRepository<PhoneNumber> phoneNumberRepository) { source.PhoneNumbers.Where(x => !x.IsNew()).ToList().ForEach(updatedPhoneNumber => { var domainPhoneNumber = destination.PhoneNumbers.FirstOrDefault(x => x.Id == updatedPhoneNumber.Id); if (domainPhoneNumber == null) { throw new ArgumentNullException("You trying to update phone number which is actually doesn't exists in database"); } if (updatedPhoneNumber.ShouldBeRemoved()) { phoneNumberRepository.Delete(updatedPhoneNumber.Id); } else { domainPhoneNumber.Update(updatedPhoneNumber); } }); }
public void SaveUser(User user) { if (user.UserID == 0) { user.Role = User.UserRole.Inactive; context.Users.Add(user); } else { User dbEntry = context.Users.Find(user.UserID); if (dbEntry != null) { dbEntry.UserName = user.UserName; dbEntry.Password = user.Password; dbEntry.Email = user.Email; dbEntry.Role = user.Role; dbEntry.RegisterDate = user.RegisterDate; } } context.SaveChanges(); }
private static void PerformPhotoSaving(User destination, UserDTO source, IRepository<File> fileRepository) { var photoInDTO = source.Photo; if (photoInDTO != null) { var photoInDb = fileRepository.GetByID(source.Photo.Id); if (photoInDb == null) { throw new Exception("Database doesn't contains such entity"); } if (photoInDTO.ShouldBeRemoved()) { fileRepository.Delete(photoInDb.Id); } else { photoInDb.Update(photoInDTO); destination.Photo = photoInDb; } } }
public async Task <TokenDto> GenerateJwtToken(Domain.Entities.User user) { Guard.Against.Null(user, nameof(user)); var claims = new List <Claim> { new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.Name, user.Username), new Claim("username", user.Username) }; var roles = user.Roles.Select(x => x.Role).ToList(); foreach (var role in roles) { claims.Add(new Claim(ClaimTypes.Role, role.Name)); } var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration.GetSection("AppSettings:Token").Value)); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha512Signature); var expires = DateTime.Now.AddMinutes(Convert.ToDouble(_configuration["JwtExpireMinutes"])); var token = new JwtSecurityToken( claims: claims, expires: expires, signingCredentials: creds ); var refreshToken = await _refreshTokenService.CreateRefreshToken(token.Id, user, commit : true); return(new TokenDto { Token = new JwtSecurityTokenHandler().WriteToken(token), RefreshToken = refreshToken.Token }); }
public ActionResult Login(User data, bool persistCookie = false) { try { if ((authProvider.Authenticate(data))) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket ( 1, data.UserName, DateTime.Now, DateTime.Now.AddMinutes(30), false, FormsAuthentication.FormsCookiePath ); Response.Cookies.Add ( new HttpCookie ( FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket) ) ); Response.Cookies.Add(new HttpCookie("username", data.UserName)); var cookie = Request.Cookies[FormsAuthentication.FormsCookieName]; var ticketInfo = FormsAuthentication.Decrypt(cookie.Value); return Json(new { result = "success" }); } else { return Json(new { result = "error", message = "Incorrect login or/and password." }); } } catch { return Json(new { result = "error", message = "Unknown error!\nPlease, try again later." }); } }
public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Manage")); } if (ModelState.IsValid) { // Get the information about the user from the external login provider var info = await AuthenticationManager.GetExternalLoginInfoAsync(); if (info == null) { return(View("ExternalLoginFailure")); } var user = new Domain.Entities.User { Email = model.Email }; var result = await UserManager.CreateAsync(user); if (result.Succeeded) { result = await UserManager.AddLoginAsync(user.Id, info.Login); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToLocal(returnUrl)); } } AddErrors(result); } ViewBag.ReturnUrl = returnUrl; return(View(model)); }
public async Task <IHttpActionResult> Delete(int id) { var userId = GetCurrentUserId(Request); User user = await _userService.GetById(userId); Product product = await _productService.GetById(id); if (product == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } await _productService.DeleteFromUserProduct(user.Id, product.Id); _elasticProductService.UpdateDoc(product.Id, product); if (product.UserProducts.All(c => c.ProductId != id)) { _elasticProductService.DeleteFromIndex(product.Id); await _productService.Delete(product); } return(Ok()); }
public void SignIn(User user, bool createPersistentCookie) { var accountEntry = new AccountEntry(user); var authTicket = new FormsAuthenticationTicket(1, user.Login, DateTime.Now, DateTime.Now.AddMinutes(45), createPersistentCookie, accountEntry.Serialize()); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { Expires = DateTime.Now.Add(FormsAuthentication.Timeout), }; HttpContext.Current.Response.Cookies.Add(authCookie); var identity = new CustomIdentity(accountEntry, authTicket.Name); HttpContext.Current.User = new GenericPrincipal(identity, identity.GetRoles()); }
public UserReportViewModel(User user) { this.user = user; }
public void UserCreatedWithError(Entity.User user, string errorMessage) { Assert.False(user.IsValid); Assert.Equal(errorMessage, user.Error.FirstOrDefault()); }
/// <summary> /// Deletes a user from the context /// </summary> /// <param name="user"></param> public void Delete(User user) { GetUnitOfWork.Users.DeleteObject(user); }
public async Task CreateNewProductTest() { //Arrange var userId = 11; var productId = 33; List <UserProduct> products = new List <UserProduct> { new UserProduct { Checked = true, ProductId = 33, UserId = 11 }, new UserProduct { Checked = true, ProductId = 33, UserId = 14 }, new UserProduct { Checked = true, ProductId = 33, UserId = 17 } }; List <ProvidersProductInfo> providersProductInfos = new List <ProvidersProductInfo> { new ProvidersProductInfo { ImageUrl = "asd", MinPrice = 12, MaxPrice = 16, ProviderName = "Onliner", Id = 1, Url = "qwe" } }; Product newProduct = new Product { Id = productId, ExternalProductId = "432", Name = "asdasasf", ProvidersProductInfos = providersProductInfos, UserProducts = products }; ProductDto newProductDto = new ProductDto() { Id = productId, Checked = true, ExternalProductId = "432", Name = "asdasasf", MinPrice = 12, MaxPrice = 16, Url = "aasdsad", ImageUrl = "asdasd" }; User user = new User { Id = userId, SocialNetworkName = "Twitter", Username = "******", SocialNetworkUserId = "297397558", Token = "4f60b211517aa86a67bace12231d2530", Email = "*****@*****.**", UserProducts = products }; var mockProductService = new Mock <IProductService>(); var mockUserService = new Mock <IUserService>(); var mockProductMessageService = new Mock <IProductMessageService>(); var mockElasticService = new Mock <IElasticService <Product> >(); mockProductService.Setup(x => x.GetByExtId(newProductDto.ExternalProductId, userId)).Returns((Product)null); mockProductService.Setup(x => x.GetByExtIdFromDb(newProduct.ExternalProductId)).Returns(newProduct); mockProductService.Setup(x => x.Create(It.IsAny <Product>())).ReturnsAsync(newProduct); mockUserService.Setup(x => x.GetById(userId)).ReturnsAsync(user).Verifiable(); mockElasticService.Setup(x => x.AddToIndex(It.IsAny <Product>(), It.IsAny <int>())).Verifiable(); var controller = new ProductsController(mockProductService.Object, mockUserService.Object, mockElasticService.Object, mockProductMessageService.Object) { Request = new HttpRequestMessage() }; //Set up OwinContext controller.Request.SetOwinContext(new OwinContext()); var owinContext = controller.Request.GetOwinContext(); owinContext.Set("userId", userId); //Act ProductDto result = await controller.Post(newProductDto); //Assert Assert.IsNotNull(result); mockProductService.Verify(); mockElasticService.Verify(); }
/// <summary> /// Adds a user to the context /// </summary> /// <param name="user"></param> public void Add(User user) { GetUnitOfWork.Users.AddObject(user); }
public void SaveUser(User user) { userData.SaveChanges(user); }
public void GivenASeriesOfUsers() { User1 = new User{UserID = 1, UserName = "******", Password = "******"}; User2 = new User {UserID = 2}; User3 = new User {UserID = 3}; }
//Fn to create a Membership user from a Entities.Users class private MembershipUser GetMembershipUser(User user) { return new MembershipUser(Name, user.Username, user.Id, user.Email, user.PasswordQuestion, user.Comment, user.IsApproved, user.IsLockedOut, user.CreationDate, user.LastLoginDate, user.LastActivityDate, user.LastPasswordChangedDate, user.LastLockedOutDate); }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { if (string.IsNullOrEmpty(username)) { status = MembershipCreateStatus.InvalidUserName; return null; } if (string.IsNullOrEmpty(password)) { status = MembershipCreateStatus.InvalidPassword; return null; } if (string.IsNullOrEmpty(email)) { status = MembershipCreateStatus.InvalidEmail; return null; } string hashedPassword = Crypto.HashPassword(password); if (hashedPassword.Length > 128) { status = MembershipCreateStatus.InvalidPassword; return null; } using (var context = new DataContext()) { if (context.Users.Any(usr => usr.Username == username)) { status = MembershipCreateStatus.DuplicateUserName; return null; } if (context.Users.Any(usr => usr.Email == email)) { status = MembershipCreateStatus.DuplicateEmail; return null; } var newUser = new User { Id = Guid.NewGuid(), Username = username, Password = hashedPassword, IsApproved = isApproved, Email = email, CreateDate = DateTime.UtcNow, LastPasswordChangedDate = DateTime.UtcNow, PasswordFailuresSinceLastSuccess = 0, LastLoginDate = DateTime.UtcNow, LastActivityDate = DateTime.UtcNow, LastLockoutDate = DateTime.UtcNow, IsLockedOut = false, LastPasswordFailureDate = DateTime.UtcNow }; context.Users.Add(newUser); context.SaveChanges(); status = MembershipCreateStatus.Success; var direccion = "http://www.HolidaysReminder.somee.com/Account/ConfirmarCuenta/?confirm="; Gateway.SendMailConfirm(email, newUser.Id.ToString(), newUser.Username,direccion,null); return new MembershipUser(System.Web.Security.Membership.Provider.Name, newUser.Username, newUser.Id, newUser.Email, null, null, newUser.IsApproved, newUser.IsLockedOut, newUser.CreateDate.Value, newUser.LastLoginDate.Value, newUser.LastActivityDate.Value, newUser.LastPasswordChangedDate.Value, newUser.LastLockoutDate.Value); } }
// Create a new Membership user public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { var args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != "") { status = MembershipCreateStatus.DuplicateEmail; return null; } var u = GetUser(username, false); if (u == null) { var createDate = DateTime.Now; var user = new User() { Username = username, Password = EncodePassword(password), Email = email, PasswordQuestion = passwordQuestion, PasswordAnswer = EncodePassword(passwordAnswer), IsApproved = isApproved, Comment = "", CreationDate = createDate, LastPasswordChangedDate = createDate, LastActivityDate = createDate, ApplicationName = _applicationName, IsLockedOut = false, LastLockedOutDate = createDate, FailedPasswordAttemptCount = 0, FailedPasswordAttemptWindowStart = createDate, FailedPasswordAnswerAttemptCount = 0, FailedPasswordAnswerAttemptWindowStart = createDate }; try { users.Update(user); users.SaveChanges(); status = MembershipCreateStatus.Success; // Note: not sure if I need this // status = MembershipCreateStatus.UserRejected; } catch (Exception e) { status = MembershipCreateStatus.ProviderError; if (WriteExceptionsToEventLog) WriteToEventLog(e, "CreateUser"); } return GetUser(username, false); } else status = MembershipCreateStatus.DuplicateUserName; return null; }
public ActionResult Register(AccountRegisterModel model) { if (ModelState.IsValid) { var testEmail = _readOnlyRepository.FirstOrDefault<User>(x => x.Email == model.Email); if (testEmail != null) { ModelState.AddModelError("", "An account with that e-mail address already exists!"); return View(model); } var newUser = new User { Email = model.Email, Name = model.Name, Password = model.Password, IsAdmin = false }; PasswordEncryptionService.Encrypt(newUser); _writeOnlyRepository.Create(newUser); return RedirectToAction("Login"); } return View(model); }
public JsonResult Register(User user) { try { if (user != null) { try { user.RegisterDate = DateTime.Now; userRepository.SaveUser(user); return Json(new { result = "success", message = "Thank you for registering! Your request is in processing.\nYou'll be informed about the activation of your account by an e-mail" }); } catch { return Json(new { result = "error", message = "A user with such Email address/Username already exists. Please, enter another one." }); } } else { return Json(new { result = "error", message = "Registration error!\nPlease, try again later." }); } } catch { return Json(new { result = "error", message = "Registration error! Maybe, DB is down.\nPlease, try register later." }); } }
public void GivenAnAdmin() { Author = new User {UserID = 1}; }
public AccountEntry(User account) { Name = account.Login; Id = account.Id; }
public void SeedData() { if (!_context.Users.Any()) { var user1 = _context.Users.Create(); user1 = new User { FirstName = "Sara", LastName = "Muller", Email = "*****@*****.**", IsActive = true, Password = Cryptography.Base64Encrypt("123"), }; _context.Users.Add(user1); var user2 = _context.Users.Create(); user2 = new User { FirstName = "David", LastName = "Luca", Email = "*****@*****.**", IsActive = true, Password = Cryptography.Base64Encrypt("123"), }; _context.Users.Add(user2); var user3 = _context.Users.Create(); user3 = new User { FirstName = "Artur", LastName = "Lodovski", Email = "*****@*****.**", IsActive = true, Password = Cryptography.Base64Encrypt("123"), }; _context.Users.Add(user3); var user4 = _context.Users.Create(); user4 = new Domain.Entities.User { FirstName = "Maria", LastName = "Babian", Email = "*****@*****.**", IsActive = true, Password = Cryptography.Base64Encrypt("123"), }; _context.Users.Add(user4); var user5 = _context.Users.Create(); user5 = new User { FirstName = "Michel", LastName = "Sanz", Email = "*****@*****.**", IsActive = true, Password = Cryptography.Base64Encrypt("123"), }; _context.Users.Add(user5); _context.SaveChanges(); var appointment1 = _context.Appointments.Create(); appointment1 = new Appointment { AppointmentDateTime = new DateTime(2019, 01, 15, 10, 30, 0), Title = "Project Planning", Description = "Start of sprint #21, planning", Organizer = user1, }; appointment1.Attendees.Add(user1); appointment1.Attendees.Add(user2); appointment1.Attendees.Add(user3); _context.Appointments.Add(appointment1); var appointment2 = _context.Appointments.Create(); appointment2 = new Appointment { AppointmentDateTime = new DateTime(2019, 01, 27, 10, 00, 00), Title = "Sprint Demo", Description = "Demo of sprint #21", Organizer = user1, }; appointment2.Attendees.Add(user1); appointment2.Attendees.Add(user2); appointment2.Attendees.Add(user3); _context.Appointments.Add(appointment2); var appointment3 = _context.Appointments.Create(); appointment3 = new Appointment { AppointmentDateTime = new DateTime(2019, 01, 27, 11, 00, 00), Title = "Retrospective", Description = "Retrospective of sprint #21", Organizer = user1, }; appointment3.Attendees.Add(user1); appointment3.Attendees.Add(user2); appointment3.Attendees.Add(user3); _context.Appointments.Add(appointment3); var appointment4 = _context.Appointments.Create(); appointment4 = new Appointment { AppointmentDateTime = new DateTime(2019, 01, 28, 10, 30, 0), Title = "Project Planning", Description = "Start of sprint #22, planning", Organizer = user1, }; appointment4.Attendees.Add(user1); appointment4.Attendees.Add(user2); appointment4.Attendees.Add(user3); _context.Appointments.Add(appointment4); var appointment5 = _context.Appointments.Create(); appointment5 = new Appointment { AppointmentDateTime = new DateTime(2019, 02, 10, 10, 00, 00), Title = "Sprint Demo", Description = "Demo of sprint #22", Organizer = user1, }; appointment5.Attendees.Add(user1); appointment5.Attendees.Add(user2); appointment5.Attendees.Add(user3); _context.Appointments.Add(appointment5); var appointment6 = _context.Appointments.Create(); appointment6 = new Appointment { AppointmentDateTime = new DateTime(2019, 02, 10, 11, 00, 00), Title = "Retrospective", Description = "Retrospective of sprint #22", Organizer = user1, }; appointment6.Attendees.Add(user1); appointment6.Attendees.Add(user2); appointment6.Attendees.Add(user3); _context.Appointments.Add(appointment6); var appointment7 = _context.Appointments.Create(); appointment7 = new Appointment { AppointmentDateTime = new DateTime(2019, 02, 03, 10, 30, 0), Title = "Client Meeting", Description = "Client meeting for analysing Tasks", Organizer = user1, }; appointment7.Attendees.Add(user1); appointment7.Attendees.Add(user2); appointment7.Attendees.Add(user3); _context.SaveChanges(); } }
public UserEditPresenter(UserEditForm view, int id) : this(view) { this.user = model.GetById(id); this.userIsFromBase = true; }