private static OperatingUser GetDefaultEntry() { var defaultUser = new OperatingUser { UserName = "******", SocialSecurityNumber = "120912786", FirstName = "Admin", LastName = "Admin", StreetAddress = "Default_Street", Municipality = "Default", Province = "New Brunswick", PostalCode = "E1A3O1", HomePhone = "46456656756", CellPhone = "5069871209", OfficePhoneNumber = "5069871209", DateOfBirth = new DateTime(1999, 05, 09, 00, 00, 00), RoleID = RoleNames.OFFICE_MANAGER, RegistrationDate = DateTime.Now, UpdatedDate = DateTime.Now, IsActive = true, IsVerified = true, }; return(defaultUser); }
public static OperatingUser MapInputUserToModel(OperatingUserInputModel inputModel) { var userRes = new OperatingUser() { ID = inputModel.ID, UserName = inputModel.UserName, SocialSecurityNumber = inputModel.SocialSecurityNumber, FirstName = inputModel.FirstName, LastName = inputModel.LastName, MiddleName = inputModel.MiddleName, StreetAddress = inputModel.StreetAddress, Municipality = inputModel.Municipality, Province = inputModel.Province, PostalCode = inputModel.PostalCode, HomePhone = inputModel.HomePhone, CellPhone = inputModel.CellPhone, OfficePhoneNumber = inputModel.OfficePhoneNumber, DateOfBirth = inputModel.DateOfBirth, RoleID = inputModel.RoleID, RegistrationDate = inputModel.RegistrationDate, UpdatedDate = inputModel.UpdatedDate, UserCreatorId = inputModel.UserCreatorId, UserUpdatorId = inputModel.UserUpdatorId, IsVerified = inputModel.IsVerified }; return(userRes); }
public async Task <int> Delete(OperatingUser user) { _context.Entry(user).State = EntityState.Modified; return(await _context.SaveChangesAsync()); }
public async Task <int> Update(OperatingUser user) { var entry = _context.Entry(user); entry.State = EntityState.Modified; return(await _context.SaveChangesAsync()); }
public ContentController( IContentService contentService, IOptions <AppSettings> appSettings, OperatingUser operatingUser) { _contentService = contentService; _appSettings = appSettings.Value; _operatingUser = operatingUser; }
public UserContentController( IUserContentService userContentService, IOptions <AppSettings> appSettings, OperatingUser operatingUser) { _userContentService = userContentService; _appSettings = appSettings.Value; _operatingUser = operatingUser; }
public UsersController( IUserService userService, IOptions <AppSettings> appSettings, OperatingUser operatingUser) { _userService = userService; //_mapper = mapper; _appSettings = appSettings.Value; _operatingUser = operatingUser; }
public void SetProfileDriverLicense(HttpPostedFileBase imageFile, OperatingUser user, DateTime?expireyDate) { var userLicense = GetUserImageModel(imageFile); userLicense.UserCreatorId = user.ID; userLicense.DateAdded = DateTime.Now; userLicense.FileType = UserFileType.DRIVER_LICENSE; userLicense.LicenseExpiryDate = expireyDate.Value; user.DriverLicenses.Add(userLicense); }
public async Task <int> SaveUserImages(OperatingUser user) { //if there is new image... if (user.DriverLicenses.Any(i => i.ID == 0)) { foreach (var license in user.DriverLicenses) { if (license.ID == 0) { user.IsVerified = false; _context.Entry(license).State = EntityState.Added; } else { license.IsArchived = true; license.DateArchived = DateTime.Now; _context.Entry(license).State = EntityState.Modified; } } } if (user.ProfileImage != null)//If they didn't add a profile image (Edge case) { if (user.ProfileImage.ID > 0) { var findImage = _context.UsersProfileImages.Find(user.ProfileImage.ID); if (findImage != null) { findImage = user.ProfileImage; user.ProfileImage.UserUpdatorId = user.ID; _context.Entry(findImage).State = EntityState.Modified; } } else { _context.Entry(user.ProfileImage).State = EntityState.Added; } } var entry = _context.Entry(user); entry.State = EntityState.Modified; return(await _context.SaveChangesAsync()); }
public void SetUserProfileImage(HttpPostedFileBase imageFile, OperatingUser user) { var userImageModel = GetUserImageModel(imageFile); if (user.ProfileImage == null) { userImageModel.UserCreatorId = user.ID; userImageModel.DateAdded = DateTime.Now; userImageModel.FileType = UserFileType.Photo; userImageModel.LicenseExpiryDate = DateTime.Now; user.ProfileImage = userImageModel; } else { user.ProfileImage.FileName = userImageModel.FileName; user.ProfileImage.Content = userImageModel.Content; user.ProfileImage.ContentType = userImageModel.ContentType; } }
public UserProfileViewModel GetDefaultProfileViewModel(OperatingUser user) { var model = new UserProfileViewModel { UserID = user.ID, UserName = user.UserName, FullName = user.FullName, UserProfileImage = user.ProfileImage, UserProfileDrivingLicense = user.CurrentDrivingLicense, IsVerified = user.IsVerified, DateOfBirth = user.DateOfBirth, StreetAddress = user.StreetAddress, Municipality = user.Municipality, Province = user.Province, PostalCode = user.PostalCode, CellPhone = user.CellPhone, IsTypeAgent = user.RoleID == RoleNames.AGENT }; return(model); }
public OperatingUserViewModel() { InputModel = new OperatingUser(); rolesList = new List <IdentityRole>(); SearchModel = new UserSearchViewModel(); }
public async Task <ActionResult> Edit(OperatingUser inputModel) { if (ModelState.IsValid) { try { var currentLoggedUserId = User.Identity.GetUserId(); var currentLoggedUserRes = await UserIdentityManager.GetUserById (currentLoggedUserId); var userMappedRes = inputModel; userMappedRes.UserUpdatorId = currentLoggedUserRes.registeredUser.ID; userMappedRes.UpdatedDate = DateTime.Now; var identityUser = await UserIdentityManager .GetUserFromModelId(userMappedRes.ID); if (identityUser != null) { var result = await UserIdentityManager.Changerole (identityUser, userMappedRes.RoleID); userMappedRes.IsActive = true; if (userMappedRes.RoleID != RoleNames.AGENT) { userMappedRes.IsVerified = true; } var res = await _userRepo.Update(userMappedRes); if (res > 0) { return(RedirectToAction("Details", new { id = userMappedRes.ID })); } else { model.InputModel = inputModel; model.rolesList = await UserIdentityManager.GetRoles(); return(View("Edit", model)); } } } catch (Exception ex) { model.InputModel = inputModel; model.rolesList = await UserIdentityManager.GetRoles(); ModelState.AddModelError(string.Empty, ex.Message); return(View("Edit", model)); } } model.InputModel = inputModel; model.rolesList = await UserIdentityManager.GetRoles(); return(View("Edit", model)); }
public Viewing() { ViewingHost = new OperatingUser(); Listing = new Listing(); Customer = new Customer(); }
public async Task <int> Create(OperatingUser item) { throw new NotImplementedException(); }