public ActionResult UserRegistration(Models.UserViewModel userViewModel, string ButtonType) { if (ButtonType == "Next") { if (ModelState.IsValid) { //check user_exists CurrentUserModel = userViewModel; // CurrentParents.First().Parent.K12User = new Entity.K12User() { Username = userViewModel.Username, Password = userViewModel.Password, Email = userViewModel.Email }; CurrentStudent.Parents = CurrentParents; ModelState.Clear(); return(View("Confirmation", CurrentStudent)); } } else if (ButtonType == "Back") { return(View("StudentExtraInfo", StudentExtraInfoModel)); } return(View()); }
//// GET: SPMUsers/Details/5 //public ActionResult Details(string id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // SPMUser sPMUser = db.SPMUsers.Find(id); // if (sPMUser == null) // { // return HttpNotFound(); // } // return View(sPMUser); //} // GET: SPMUsers/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.UserViewModel user = new Models.UserViewModel(); using (var context = new MOE.Common.Models.SPM()) { List <string> roles; var userStore = new UserStore <SPMUser>(context); var userManager = new UserManager <SPMUser>(userStore); var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); user.User = userManager.Users.Where(u => u.Id == id).FirstOrDefault(); foreach (IdentityUserRole role in user.User.Roles) { user.Roles.Add(roleManager.Roles.Where(r => r.Id == role.RoleId).First().Name); } roles = (from r in roleManager.Roles select r.Name).ToList(); ViewBag.Roles = new SelectList(roles.OrderBy(r => r)); } if (user == null) { return(HttpNotFound()); } return(View(user)); }
public ActionResult Edit(Guid id, FormCollection collection) { var studentViewModel = new Models.UserViewModel(); UpdateModel(studentViewModel, collection); // add selected Majors to User instance foreach (var major in studentViewModel.Majors) { studentViewModel.User.Majors.Add(new Major { Id = Guid.NewGuid(), Name = major }); } var retVal = UserManager.UpdateUser(studentViewModel.User, studentViewModel.User.Majors); // also update IdentityUser Models.IdentityModelsHelper.UpdateIdentityUserRole(studentViewModel.User.Email, studentViewModel.User.Role.ToString()); if (retVal.Success) { TempData["success-message"] = String.Format("{0} {1} has been updated", studentViewModel.User.FirstName, studentViewModel.User.LastName); return(RedirectToAction("Index")); } TempData["failure-message"] = String.Format("Error updating record for {0} {1}", studentViewModel.User.FirstName, studentViewModel.User.LastName); return(View(studentViewModel)); }
public Models.UserViewModel UpdateUserOnLineStatus(Models.UserViewModel user) { var userDto = user.ToDtoModel(); httpClient.PutAsJsonAsync("api/User/OnLine", user, true); return(user); }
public IHttpActionResult Login(Models.UserViewModel usr) { try { using (DatabaseContext dbctx = new DatabaseContext()) { String userRole = dbctx.UserAccounts.Where(usn => usn.Username.Equals(usr.Username)) .Where(usp => usp.Password.Equals(usr.Password)) .Select(column => column.UserRole).First(); if (userRole != null || userRole != String.Empty) { var permissions = UserManagementHelper.GetPermissionsDictionaryFor(userRole); LoggerHelper.UserAction(usr.Username, "Autentificare cu succes "); return(Ok(permissions)); } } } catch (Exception ex) { Console.WriteLine("Exception in AccountController/api/User/Login", ex.ToString()); LoggerHelper.UserAction(usr.Username, "Autentificare esuata "); return(NotFound()); } return(Ok()); }
public ActionResult Edit(Models.UserViewModel sPMUser) { if (ModelState.IsValid) { SPMUser user; using (var context = new MOE.Common.Models.SPM()) { try { var userStore = new UserStore <SPMUser>(context); var userManager = new UserManager <SPMUser>(userStore); user = userManager.Users.Where(u => u.Id == sPMUser.User.Id).FirstOrDefault(); user.ReceiveAlerts = sPMUser.User.ReceiveAlerts; user.Email = sPMUser.User.Email; user.UserName = sPMUser.User.Email; context.SaveChanges(); } catch (Exception ex) { return(Content("<h1>" + ex.Message + "</h1>")); } } return(RedirectToAction("Index")); } return(View(sPMUser)); }
public static UserEntity ToBllUser(this Models.UserViewModel userViewModel) { return(new UserEntity() { UserId = userViewModel.UserId, Login = userViewModel.Login, RoleId = (int)userViewModel.Role, Email = userViewModel.Email, Password = userViewModel.Password, }); }
public Models.UserViewModel AddUser(Models.UserViewModel user) { if (user == null) { throw new ArgumentNullException("user"); } var userDto = httpClient.PostAsJsonAsyncWithReturnValue("api/User", user.ToDtoModel()); return(userDto.ToViewModel()); }
public IActionResult Manage(int?id) { var user = new Models.UserViewModel(); ViewData["Roles"] = context.Role.ToList(); if (id.HasValue) { user = GetUserViewModels(context.User.SingleOrDefault(x => x.Id == id)); } return(View(user)); }
public ActionResult UserInfoPartial(Models.UserViewModel userDetails) { B_UserController bUCtr = new B_UserController(); User user = bUCtr.GetUserByUserName(User.Identity.Name); userDetails.UserName = user.UserName; userDetails.Email = user.Email; userDetails.Phone = user.Phone; userDetails.ZipCode = user.ZipCode; userDetails.Region = user.Region; return(PartialView(userDetails)); }
public ActionResult LabelList() { int adminId = Convert.ToInt16(Session["AdminId"]); UserViewModel _model = new Models.UserViewModel(); contactServices _ser = new Database.contactServices(); if (TempData["Error"] != null) { _model.Error = TempData["Error"].ToString(); } return(View(_model)); }
public ActionResult Index() { int adminId = Convert.ToInt16(Session["AdminId"]); UserViewModel _model = new Models.UserViewModel(); contactServices _ser = new Database.contactServices(); _model.labels = _ser.getAllLablesByAdminid(adminId)._labelList; if (TempData["Error"] != null) { _model.Error = TempData["Error"].ToString(); } return(View(_model)); }
public ActionResult Login(Models.UserViewModel model) { if (ModelState.IsValid) { User user = WebApplication1.Shared.DB.Login(model.Username, model.Password); if (user != null) { WebApplication1.Shared.DB.LogIn(user); return(RedirectToAction("Dashboard")); } } ViewData["message"] = "Username or password is incorrect. Please try again."; return(View()); }
public ActionResult Activate(Guid id, FormCollection collection) { var student = UserManager.GetUserById(id); var activateRetVal = UserManager.ActivateUser(student); if (activateRetVal.Success) { TempData["success-message"] = String.Format("{0} {1} has been activated", student.FirstName, student.LastName); return(RedirectToAction("Index", "User")); } TempData["failure-message"] = String.Format("Error activating '{0} {1}'", student.FirstName, student.LastName); var studentViewModel = new Models.UserViewModel(student); return(View(studentViewModel)); }
// GET: User/Edit/5 public ActionResult Edit(Guid?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } var user = UserManager.GetUserById(id.Value); if (user != null && user.Id != Guid.Empty) { var userViewModel = new Models.UserViewModel(user); return(View(userViewModel)); } return(RedirectToAction("Index")); }
public ActionResult Edit(Guid?id) { if (!id.HasValue) { return(RedirectToAction("Index", "Student")); } var student = UserManager.GetUserById(id.Value); if (student != null && student.Id != Guid.Empty) { var studentViewModel = new Models.UserViewModel(student); return(View(studentViewModel)); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Delete(int id, Models.UserViewModel user) { try { HttpResponseMessage responseMessage = await client.DeleteAsync(url + "/Drop/" + id); if (responseMessage.IsSuccessStatusCode) { var responseData = responseMessage.Content.ReadAsStringAsync().Result; } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Details(Guid?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } var user = UserManager.GetUserById(id.Value); if (user != null && user.Id != Guid.Empty) { var userViewModel = new Models.UserViewModel(user); userViewModel.PhotoUrl = string.Format("http://www.gravatar.com/avatar/{0}?size=200&d=http://media.tumblr.com/tumblr_lak5phfeXz1qzqijq.png", Hash.HashEmailForGravatar(userViewModel.User.Email)); return(View(userViewModel)); } return(RedirectToAction("Index")); }
public override Task OnConnected() { var id = Context.ConnectionId; var user = Context.User; int userId = int.Parse(user.Identity.GetUserId()); _connections.Add(userId, id); //userManager = (IUserManager)DependencyResolver.Current.GetService(typeof(IUserManager)); Models.UserViewModel uservm = userManager.GetViewModel(userId); uservm.UserIsOnLine = true; uservm = userManager.UpdateUserOnLineStatus(uservm); IHubContext context = GlobalHost.ConnectionManager.GetHubContext <ChatHub>(); Clients.AllExcept(id).userConnected(userId, uservm.UserDisplayName); return(base.OnConnected()); }
/// <summary> /// Gets a user or create it based on its JID. /// </summary> /// <param name="jid">The jid.</param> /// <returns>A user in the Contact List.</returns> public Models.UserViewModel GetUser(Jid jid) { foreach (var contact in AllContacts) { if (jid.GetBareJid() == contact.Jid.GetBareJid()) { return(contact); } } // Create a temporary contact if a non-roster user creates a conversation. // Allows administrator to talk to anyone. // Change ctor in user var tempContact = new Models.UserViewModel(jid, ""); UICollection.AddOnUI(AllContacts, tempContact); return(tempContact); }
public async Task <ActionResult> Create(Models.UserViewModel user) { try { var userEntity = Mapper.Map <UserViewModel, UserEntity>(user); HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "/Add", userEntity); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } catch (Exception) { return(View()); } }
public async Task <ActionResult> Edit(int id, Models.UserViewModel user) { try { var userEntity = Mapper.Map <UserViewModel, UserEntity>(user); HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url + "/Update/" + id, userEntity); if (responseMessage.IsSuccessStatusCode) { var responseData = responseMessage.Content.ReadAsStringAsync().Result; } return(RedirectToAction("Index")); } catch (Exception) { return(View()); } }
public ActionResult Deactivate(Guid id, FormCollection collection) { var student = UserManager.GetUserById(id); var deactivateRetVal = UserManager.DeactivateUser(student); // don't need this call anymore; not actually deleting anyone //Models.IdentityModelsHelper.DeleteIdentityUser(student.Email); if (deactivateRetVal.Success) { TempData["success-message"] = String.Format("{0} {1} has been deactivated", student.FirstName, student.LastName); return(RedirectToAction("Index", "Student")); } TempData["failure-message"] = String.Format("Error deactivating '{0} {1}'", student.FirstName, student.LastName); var studentViewModel = new Models.UserViewModel(student); return(View(studentViewModel)); }
// GET: SPMUsers public ActionResult Index() { List <Models.UserViewModel> users = new List <Models.UserViewModel>(); using (var context = new MOE.Common.Models.SPM()) { var userStore = new UserStore <SPMUser>(context); var userManager = new UserManager <SPMUser>(userStore); var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); foreach (SPMUser user in userStore.Users.OrderBy(u => u.Email).ToList()) { Models.UserViewModel userViewModel = new Models.UserViewModel(); userViewModel.User = user; foreach (IdentityUserRole role in user.Roles) { userViewModel.Roles.Add(roleManager.Roles.Where(r => r.Id == role.RoleId).First().Name); } users.Add(userViewModel); } } return(View(users)); }
// // GET: /Users/ public ActionResult Index() { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); UI.Models.UserViewModel userviewdata = new Models.UserViewModel(); List <Business.ApplicationService.appuser> allusers = new List <Business.ApplicationService.appuser>(); List <Business.ApplicationService.appuser> admins = new List <Business.ApplicationService.appuser>(); List <Business.ApplicationService.appuser> recruiters = new List <Business.ApplicationService.appuser>(); List <Business.ApplicationService.appuser> consultants = new List <Business.ApplicationService.appuser>(); List <Business.ApplicationService.appuser> timesheetadmins = new List <Business.ApplicationService.appuser>(); Business.ApplicationService.appuser loggedinuser = appclient.GetUserObject(Session["usertoken"].ToString()); if (loggedinuser.ObjectType.ToLower() == "private") { admins = appclient.GetAdmins(Session["companyid"].ToString(), "comadmin", Session["usertoken"].ToString()).ToList(); recruiters = appclient.GetAdmins(Session["companyid"].ToString(), "comrecruit", Session["usertoken"].ToString()).ToList(); allusers.AddRange(admins); allusers.AddRange(recruiters); Business.menuitem addrecruiter = new Business.menuitem(); addrecruiter.linkname = "Add Recruiter"; addrecruiter.linkpath = "/users/recruiter"; addrecruiter.menuposition = 1; userviewdata.actions.Add(addrecruiter); Business.menuitem addadmin = new Business.menuitem(); addadmin.linkname = "Add Admin"; addadmin.linkpath = "/users/admin"; addadmin.menuposition = 2; userviewdata.actions.Add(addadmin); userviewdata.UsersCollection = allusers; } else if (loggedinuser.ObjectType.ToLower() == "tsadmin") { consultants = appclient.GetAdmins(Session["companyid"].ToString(), "consultant", Session["usertoken"].ToString()).ToList(); allusers.AddRange(consultants); Business.menuitem addconsultant = new Business.menuitem(); addconsultant.linkname = "Add Consultant"; addconsultant.linkpath = "/users/consultant"; addconsultant.menuposition = 1; userviewdata.actions.Add(addconsultant); timesheetadmins = appclient.GetAdmins(Session["companyid"].ToString(), "tsadmin", Session["usertoken"].ToString()).ToList(); allusers.AddRange(timesheetadmins); Business.menuitem addTimeSheetAdmins = new Business.menuitem(); addTimeSheetAdmins.linkname = "Add Timesheet Admin"; addTimeSheetAdmins.linkpath = "/users/sheetadmin"; addTimeSheetAdmins.menuposition = 2; userviewdata.actions.Add(addTimeSheetAdmins); userviewdata.UsersCollection = allusers; } return(View(userviewdata)); }
public ActionResult Register(string mode, string id) { Models.UserViewModel uvModel = new Models.UserViewModel(); uvModel.MODE = mode; uvModel.DisabledClass = string.Empty; if (string.Equals(mode, "EDIT", StringComparison.OrdinalIgnoreCase) || string.Equals(mode, "VIEW", StringComparison.OrdinalIgnoreCase)) { uvModel.UserMasterId = int.Parse(id); } if (string.Equals(mode, "VIEW", StringComparison.OrdinalIgnoreCase)) { uvModel.DisabledClass = "disabledPlace"; } if (mode != null && string.Equals(mode, "EDIT", StringComparison.OrdinalIgnoreCase) || string.Equals(mode, "VIEW", StringComparison.OrdinalIgnoreCase)) { //Populate edit data using id passed in URL, if id==null then show error message StatusDTO <UserMasterDTO> dto = _userSvc.Select(Convert.ToInt32(id)); uvModel.UserMasterId = dto.ReturnObj.UserMasterId; //uvModel.UserMasterId = dto.ReturnObj.UserMasterId; uvModel.FName = dto.ReturnObj.FName; uvModel.MName = dto.ReturnObj.MName; uvModel.LName = dto.ReturnObj.LName; uvModel.Gender = dto.ReturnObj.Gender; uvModel.Image = dto.ReturnObj.Image; uvModel.DOB = dto.ReturnObj.DOB; uvModel.DOBString = uvModel.DOB.HasValue ? uvModel.DOB.Value.ToString("dd-MMM-yyyy") : string.Empty; uvModel.EmailId = dto.ReturnObj.EmailId; uvModel.ResidentialAddress = dto.ReturnObj.ResidentialAddress; uvModel.PermanentAddress = dto.ReturnObj.PermanentAddress; uvModel.ContactNo = dto.ReturnObj.ContactNo; uvModel.AltContactNo = dto.ReturnObj.AltContactNo; uvModel.BloodGroup = dto.ReturnObj.BloodGroup; uvModel.Location = dto.ReturnObj.Location; uvModel.Role = dto.ReturnObj.Role; uvModel.UserEntitlementList = _userSvc.GetUserEntitlement(dto.ReturnObj.UserMasterId); uvModel.SelectUserEntitlement = _ddlRepo.GetUserRole(); uvModel.Subject = _ddlRepo.Subject(); uvModel.Employee = new EmployeeDetailsDTO(); if (dto.ReturnObj.Employee != null) { uvModel.Employee.EmployeeId = dto.ReturnObj.Employee.EmployeeId; uvModel.hdnEmployeeId = dto.ReturnObj.Employee.EmployeeId; uvModel.Employee.EducationalQualification = dto.ReturnObj.Employee.EducationalQualification; uvModel.Employee.DateOfJoining = dto.ReturnObj.Employee.DateOfJoining; uvModel.DOJString = uvModel.Employee.DateOfJoining.HasValue ? uvModel.Employee.DateOfJoining.Value.ToString("dd-MMM-yyyy") : string.Empty; uvModel.Employee.StaffEmployeeId = dto.ReturnObj.Employee.StaffEmployeeId; uvModel.Employee.Department = dto.ReturnObj.Employee.Department; uvModel.Employee.Designation = dto.ReturnObj.Employee.Designation; uvModel.FacultyCourseList = _userSvc.GetFacultyCourseMap(dto.ReturnObj.Employee.EmployeeId); if (dto.ReturnObj.Employee.ClassType != null) { uvModel.Employee.ClassType = dto.ReturnObj.Employee.ClassType; } string employeeImageFolder = _configSvc.GetEmployeeImagesFolder(); uvModel.employeeimagepath = _configSvc.GetEmployeeImagesRelPath() + "/" + GetImageFileName(uvModel.Employee.StaffEmployeeId, employeeImageFolder); //if(dto.ReturnObj.Employee.ClassType != null) //{ // uvModel.Employee.Subject = dto.ReturnObj.Employee.Subject; //} } } uvModel.GenderList = _uiddlRepo.getGenderDropDown(); uvModel.LocationList = _uiddlRepo.getLocationDropDown(); uvModel.RoleList = _uiddlRepo.getRoleDropDown(); uvModel.DepartmentList = _uiddlRepo.getDepartmentDropDown(); uvModel.DesignationList = _uiddlRepo.getDesignationDropDown(); uvModel.SelectUserEntitlement = _ddlRepo.GetUserRole(); uvModel.ClassTypeList = _uiddlRepo.getClassTypeDropDown(); //uvModel.SubjectList = _uiddlRepo.getSubjectDropDown(); return(View(uvModel)); }
public async Task <ActionResult> UserRegistration(UserViewModel userViewModel, string ButtonType) { if (ButtonType == "Next") { if (ModelState.IsValid) { CurrentUserModel = userViewModel; ApplicationDbContext context = new ApplicationDbContext(); var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); var user = new ApplicationUser { UserName = CurrentUserModel.Username, Email = CurrentUserModel.Email, DisplayName = CurrentStaff.GetFullName() }; var result = await UserManager.CreateAsync(user, CurrentUserModel.Password); if (result.Succeeded) { if (CurrentStaff.StaffType == BLL.Constants.StaffTypes.TEACHER) { UserManager.AddToRole(user.Id, "Teacher"); var teacher = new Teacher() { ID = CurrentStaff.ID }; _unitOfWork.Teachers.Add(teacher); } CurrentStaff.user_id = user.Id; _service.Update(CurrentStaff); _unitOfWork.Addresss.Update(CurrentStaff.Address); // just to make sure try { ApplicationSignInManager SignInManager = HttpContext.GetOwinContext().Get <ApplicationSignInManager>(); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); await _unitOfWork.SaveAsync(); } catch (DbUpdateConcurrencyException) { } ModelState.Clear(); return(View("SuccessRegistration", CurrentStaff)); } } } else if (ButtonType == "Back") { return(View("StaffInfo", CurrentStaff)); } return(View()); }
//[ValidateAntiForgeryToken] public ActionResult Register(Models.UserViewModel uvModel, HttpPostedFileBase file) { string folderName = string.Empty; //if (file != null) //{ // if (file.ContentLength > 0) // { for (int i = 0; i < Request.Files.Count; i++) { string keyName = Request.Files.Keys[i]; folderName = _configSvc.GetEmployeeImagesFolder(); SaveImageFiles(folderName, Request.Files[i].FileName, uvModel.Employee.StaffEmployeeId); } // } //} SessionDTO sessionRet = _sessionSvc.GetUserSession(); uvModel.CreatedBy = sessionRet; DateTime dtValidator = new DateTime(); if (DateTime.TryParse(uvModel.DOBString, out dtValidator)) { uvModel.DOB = dtValidator; } if (DateTime.TryParse(uvModel.DOJString, out dtValidator)) { if (uvModel.Employee == null) { uvModel.Employee = new EmployeeDetailsDTO(); } uvModel.Employee.DateOfJoining = dtValidator; } if (string.Equals(uvModel.MODE, "EDIT", StringComparison.OrdinalIgnoreCase)) { //Call update StatusDTO <UserMasterDTO> status = _userSvc.Update(uvModel); if (status.IsSuccess) { if (uvModel.UserEntitlementList != null && uvModel.UserEntitlementList.Count > 0) { for (int i = 0; i < uvModel.UserEntitlementList.Count; i++) { if (uvModel.UserEntitlementList[i].RowId > 0) { _userSvc.UpdateUserEntitlement(uvModel.UserEntitlementList[i]); } else { uvModel.UserEntitlementList[i].UserDetails = new UserMasterDTO(); uvModel.UserEntitlementList[i].UserDetails.UserMasterId = uvModel.UserMasterId; _userSvc.InsertUserEntitlement(uvModel.UserEntitlementList[i]); } } } if (uvModel.FacultyCourseList != null && uvModel.FacultyCourseList.Count > 0) { for (int i = 0; i < uvModel.FacultyCourseList.Count; i++) { if (uvModel.FacultyCourseList[i].FacultyCourseMapId > 0) { _userSvc.UpdateFacultyCourseMap(uvModel.FacultyCourseList[i]); } else { uvModel.FacultyCourseList[i].Employee = new EmployeeDetailsDTO(); uvModel.FacultyCourseList[i].Employee.EmployeeId = uvModel.hdnEmployeeId; _userSvc.InsertFacultyCourse(uvModel.FacultyCourseList[i]); } } } } return(RedirectToAction("Search", "User", new { area = "User" })); } else { //Call insert string pass = encrypt.encryption(uvModel.Password); uvModel.Password = pass; uvModel.CreatedBy = sessionRet; StatusDTO <UserMasterDTO> status = _userSvc.Insert(uvModel); if (status.IsSuccess) { if (uvModel.UserEntitlementList != null && uvModel.UserEntitlementList.Count > 0) { for (int i = 0; i < uvModel.UserEntitlementList.Count; i++) { uvModel.UserEntitlementList[i].UserDetails = new UserMasterDTO(); uvModel.UserEntitlementList[i].UserDetails.UserMasterId = status.ReturnObj.UserMasterId; _userSvc.InsertUserEntitlement(uvModel.UserEntitlementList[i]); } } if (uvModel.FacultyCourseList != null && uvModel.FacultyCourseList.Count > 0) { for (int i = 0; i < uvModel.FacultyCourseList.Count; i++) { uvModel.FacultyCourseList[i].Employee = new EmployeeDetailsDTO(); uvModel.FacultyCourseList[i].Employee.EmployeeId = status.ReturnObj.Employee.EmployeeId; _userSvc.InsertFacultyCourse(uvModel.FacultyCourseList[i]); } } } uvModel.GenderList = _uiddlRepo.getGenderDropDown(); uvModel.LocationList = _uiddlRepo.getLocationDropDown(); uvModel.RoleList = _uiddlRepo.getRoleDropDown(); uvModel.DepartmentList = _uiddlRepo.getDepartmentDropDown(); uvModel.DesignationList = _uiddlRepo.getDesignationDropDown(); //return View(uvModel); return(RedirectToAction("Search", "User", new { area = "User" })); } }
// // GET: /Users/ public ActionResult Index() { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); UI.Models.UserViewModel userviewdata = new Models.UserViewModel(); List<Business.ApplicationService.appuser> allusers = new List<Business.ApplicationService.appuser>(); List<Business.ApplicationService.appuser> admins = new List<Business.ApplicationService.appuser>(); List<Business.ApplicationService.appuser> recruiters = new List<Business.ApplicationService.appuser>(); List<Business.ApplicationService.appuser> consultants = new List<Business.ApplicationService.appuser>(); List<Business.ApplicationService.appuser> timesheetadmins = new List<Business.ApplicationService.appuser>(); Business.ApplicationService.appuser loggedinuser = appclient.GetUserObject(Session["usertoken"].ToString()); if (loggedinuser.ObjectType.ToLower() == "private") { admins = appclient.GetAdmins(Session["companyid"].ToString(), "comadmin", Session["usertoken"].ToString()).ToList(); recruiters = appclient.GetAdmins(Session["companyid"].ToString(), "comrecruit", Session["usertoken"].ToString()).ToList(); allusers.AddRange(admins); allusers.AddRange(recruiters); Business.menuitem addrecruiter = new Business.menuitem(); addrecruiter.linkname = "Add Recruiter"; addrecruiter.linkpath = "/users/recruiter"; addrecruiter.menuposition = 1; userviewdata.actions.Add(addrecruiter); Business.menuitem addadmin = new Business.menuitem(); addadmin.linkname = "Add Admin"; addadmin.linkpath = "/users/admin"; addadmin.menuposition = 2; userviewdata.actions.Add(addadmin); userviewdata.UsersCollection = allusers; } else if (loggedinuser.ObjectType.ToLower() == "tsadmin") { consultants = appclient.GetAdmins(Session["companyid"].ToString(), "consultant", Session["usertoken"].ToString()).ToList(); allusers.AddRange(consultants); Business.menuitem addconsultant = new Business.menuitem(); addconsultant.linkname = "Add Consultant"; addconsultant.linkpath = "/users/consultant"; addconsultant.menuposition = 1; userviewdata.actions.Add(addconsultant); timesheetadmins = appclient.GetAdmins(Session["companyid"].ToString(), "tsadmin", Session["usertoken"].ToString()).ToList(); allusers.AddRange(timesheetadmins); Business.menuitem addTimeSheetAdmins = new Business.menuitem(); addTimeSheetAdmins.linkname = "Add Timesheet Admin"; addTimeSheetAdmins.linkpath = "/users/sheetadmin"; addTimeSheetAdmins.menuposition = 2; userviewdata.actions.Add(addTimeSheetAdmins); userviewdata.UsersCollection = allusers; } return View(userviewdata); }
public IActionResult MoveUserInformation(Models.UserViewModel userViewModel) { return(View(userViewModel)); }