public ActionResult Apply(HttpPostedFileBase file, JobUser jobUser) { if (file != null && file.ContentLength > 0) { try { string path = Path.Combine(Server.MapPath("~/Uploads"), Path.GetFileName(file.FileName)); FileInfo uploadInfo = new FileInfo(file.FileName); string newUpload = Guid.NewGuid().ToString() + uploadInfo.Extension; jobUser.CV = "~/Uploads/" + file.FileName + newUpload; //uploadInfo.Name = newUpload; //file.FileName = newUpload; file.SaveAs(path + newUpload); //file.SaveAs("~/Uploads"+newUpload); //ViewBag.Message = "File uploaded successfully"; jobUser.Date = System.DateTime.Now; _jobUserService.Add(jobUser); Session["success"] = 1; //ViewBag.deneme = true; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { ViewBag.Message = "You have not specified a file."; } return(RedirectToAction("List", "Job")); }
public void AssociateProfileAuthData(JobUser user, IEnumerable<Claim> claims) { using (IDbConnection db = _factory.OpenDbConnection()) { // get rid of previous auth db.Delete<ProfileAuthData>(auth => auth.UserId == user.UserId); // add this one db.Insert(new ProfileAuthData(user.UserId, claims)); } }
public void Update(JobUser entity) { JobUser jobUserToUpdate = context.JobUser.FirstOrDefault(x => x.Id == entity.Id); jobUserToUpdate.Name = entity.Name; jobUserToUpdate.SurName = entity.SurName; jobUserToUpdate.Date = entity.Date; jobUserToUpdate.Phone = entity.Phone; jobUserToUpdate.CV = entity.CV; jobUserToUpdate.JobID = entity.JobID; context.SaveChanges(); }
public void Execute(JobvacanciesDto request) { _validator.ValidateAndThrow(request); var newJobVacancie = new JobUser { JobId = request.JobId, UserId = _actor.Id, Status = 0, JobName = request.JobName, JobDescription = request.JobDescription }; _context.Add(newJobVacancie); _context.SaveChanges(); }
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 JobUser { UserName = model.Email, 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 void Add(JobUser entity) { context.JobUser.Add(entity); context.SaveChanges(); }
public void Update(JobUser entity) { _jobUserDal.Update(entity); }
public void Add(JobUser entity) { _jobUserDal.Add(entity); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new JobUser { UserName = model.UserName, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { if (model.IsWorker) { tbl_worker worker = new tbl_worker(); worker.asp_user_Id = user.Id; db.tbl_worker.Add(worker); await db.SaveChangesAsync(); try { await UserManager.AddToRoleAsync(user.Id, "Worker"); } catch { tbl_asp_role role = new tbl_asp_role(); role.Name = "Worker"; db.tbl_asp_role.Add(role); await db.SaveChangesAsync(); await UserManager.AddToRoleAsync(user.Id, "Worker"); } } else { tbl_company company = new tbl_company(); company.asp_user_Id = user.Id; db.tbl_company.Add(company); await db.SaveChangesAsync(); try { await UserManager.AddToRoleAsync(user.Id, "Company"); } catch { tbl_asp_role role = new tbl_asp_role(); role.Name = "Company"; db.tbl_asp_role.Add(role); await db.SaveChangesAsync(); await UserManager.AddToRoleAsync(user.Id, "Company"); } } await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); //For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 //Send an email with this link //string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("PageByRole", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }