public async Task <IActionResult> PostWorkExperience([FromBody] WorkExperience workExperience) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.WorkExperience.Add(workExperience); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (WorkExperienceExists(workExperience.WorkExperienceId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetWorkExperience", new { id = workExperience.WorkExperienceId }, workExperience)); }
public IEnumerable <WorkExperience> Experiences() { var gmi = new WorkExperience { Title = "General Mills", Description = "Fortune 100", Subtitle = "Fortune 100", Route = "/generalmills", ClassName = "gmi" }; var sparkstarter = new WorkExperience { Title = "Sparkstarter", Description = "Fortune 100", Subtitle = "Mobile Startup", Route = "/sparkstarter", ClassName = "sparkstarter" }; var gehealthcare = new WorkExperience { Title = "GE Healthcare", Description = "Fortune 100", Subtitle = "Fortune 100", Route = "/gehealthcare", ClassName = "gehealthcare" }; var exp = new[] { gmi, sparkstarter, gehealthcare }; return(exp); }
public ActionResult EditWorkExperience(WorkExperience wExp) { UnitOfWork.WorkExperienceManager.Update(wExp); ApplicationUser user = UnitOfWork.ApplicationUserManager.FindById(User.Identity.GetUserId()); return(RedirectToAction("index", user)); }
public ActionResult AddWorkExperience(WorkExperienceViewModel workExpVM) { if (ModelState.IsValid) { workExpVM.Company.PlaceType = PlaceType.Company; UnitOfWork.SavedPlaceManager.Add(workExpVM.Company); WorkExperience workExp = new WorkExperience { UserId = User.Identity.GetUserId(), Title = workExpVM.Title, Location = workExpVM.Location, Description = workExpVM.Description, EmploymentType = workExpVM.EmploymentType, CompanyId = workExpVM.Company.Id, StartDate = new DateTime(workExpVM.StartYear, workExpVM.StartMonth, 1) }; if (workExpVM.EndMonth != null && workExpVM.EndYear != null) { workExp.EndDate = new DateTime((int)workExpVM.EndYear, (int)workExpVM.EndMonth, 1); } UnitOfWork.WorkExperienceManager.Add(workExp); return(PartialView("__AddExperienceCard", workExp)); } return(View("Index")); }
public async Task <WorkExperience> UpdateWorkExperience(WorkExperience workExperience) { DbContext.WorkExperience.Update(workExperience); await DbContext.SaveChangesAsync(); return(workExperience); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Job_Type,Company,FromDate,ToDate,Description,Responsibilities")] WorkExperience workExperience) { if (id != workExperience.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(workExperience)); }
public async Task GetByIdAsync_WorksCorrectly() { string expectedResult = "PositionTest"; var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new WorkExperience() { Position = expectedResult, Institute = "InstituteTest", From = 2000, To = 2001, Resume = new Resume() }; await context.AddAsync(model); context.SaveChanges(); var workService = new WorkHistoryService(new EfRepository <Resume>(context), new EfRepository <WorkExperience>(context)); var result = await workService.GetByIdAsync(model.Id); Assert.Equal(expectedResult, result.Position); }
public async Task RemoveExistingWorkExperience_ReturnsTrue() { var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new WorkExperience() { Position = "PositionTest", Institute = "InstituteTest", From = 2000, To = 2001, }; await context.AddAsync(model); context.SaveChanges(); var workService = new WorkHistoryService(new EfRepository <Resume>(context), new EfRepository <WorkExperience>(context)); var result = await workService.RemoveWorkExperience(model.Id); Assert.True(result); var dbModels = await context.WorksHistory.AnyAsync(); Assert.False(dbModels); }
public ActionResult editWorkExperience(WorkExperience std) { WorkExperience toEdit = db.WorkExperiences.Where(a => a.id == std.id).FirstOrDefault(); if (toEdit == null) { return(Json("No Matching record")); } toEdit.Position = std.Position; toEdit.Description = std.Description; toEdit.From = std.From; toEdit.To = std.To; toEdit.LastModificationDate = DateTime.Now; db.Entry(toEdit).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbEntityValidationException e) { string message1 = e.StackTrace; foreach (var eve in e.EntityValidationErrors) { message1 += eve.Entry.State + "\n"; foreach (var ve in eve.ValidationErrors) { message1 += String.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); message1 += "\n"; } } return(Json(new { Message = message1, JsonRequestBehavior.AllowGet })); } string message = "SUCCESS"; return(Json(new { Message = message, JsonRequestBehavior.AllowGet })); }
public Guid createJobHistory(WorkExperience JobHistory) { context.JobHistorys.Add(JobHistory); context.SaveChanges(); return(JobHistory.Id); }
public ActionResult AddExperience(WorkExperience work, string id, UserWorkExperience userwork) { //userwork.UserID = D); var current = context.Users.FirstOrDefault(u => u.Id == id); // context.WorkExperiences.Add(work); context.Entry(work).State = EntityState.Added; userwork.UserID = current.Id; userwork.WorkExperienceID = work.ID; // context.UserWorkExperiences.Add(userwork); context.Entry(userwork).State = EntityState.Added; //var nn = context.UserWorkExperiences.FirstOrDefault(u => u.WorkExperienceID == work.ID); context.SaveChanges(); // return PartialView("GetExperiences", context.WorkExperiences.ToList()); var we = context.UserWorkExperiences.Where(w => w.UserID == current.Id).ToList(); List <WorkExperience> cur_workExp = new List <WorkExperience>(); foreach (var item in we) { cur_workExp.Add(context.WorkExperiences.FirstOrDefault(w => w.ID == item.WorkExperienceID)); } return(PartialView("GetExperiences", cur_workExp)); }
public static void Add(WorkExperience workExperience) { using (ApplicationDbContext db = new ApplicationDbContext()) { try { // Your code... // Could also be before try if you know the exception occurs in SaveChanges db.WorkExperiences.Add(workExperience); db.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,Position,StartTime,EndTime,JobType,UserId")] WorkExperience workExperience) { if (id != workExperience.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", workExperience.UserId); return(View(workExperience)); }
// GET: WorkExperience/Create public ActionResult Create(int id) { var education = new WorkExperience(); education.PersonId = id; return(View(education)); }
public ActionResult Save(WorkExperience workExperience) { if (!ModelState.IsValid) { var viewModel = new WorkExperiencesFormViewModel(workExperience); return(View("WorkExperiencesForm", viewModel)); } if (workExperience.Id == 0) { _context.WorkExperiences.Add(workExperience); } else { var workExperienceInDb = _context.WorkExperiences.Single(w => w.Id == workExperience.Id); workExperienceInDb.Company = workExperience.Company; workExperienceInDb.Years = workExperience.Years; workExperienceInDb.ReasonOfDeparture = workExperience.ReasonOfDeparture; } _context.SaveChanges(); return(RedirectToAction("Index", "WorkExperiences", new { id = workExperience.PersonId })); }
public async Task <IActionResult> EditResume(ResumeViewModel viewModel) { FilledResume filledResume = new FilledResume(); filledResume.UserInfo = viewModel.UserInfo; filledResume.StreamId = _streamService.GetStreamByFullName(viewModel.StreamFullName).Id; filledResume.ResumeId = viewModel.ResumeId; filledResume.Summary = viewModel.Summary; filledResume.Skills = viewModel.Skills; filledResume.ForeignLanguages = viewModel.ForeignLanguages; filledResume.Educations = viewModel.Educations; filledResume.Courses = viewModel.Courses; filledResume.Certificates = viewModel.Certificates; filledResume.Exams = viewModel.Exams; WorkExperience[] workExperiences = new WorkExperience[viewModel.WorkExperiences.Length]; for (int i = 0; i < viewModel.WorkExperiences.Count(); i++) { workExperiences[i] = viewModel.WorkExperiences[i].ToWorkExperience(); } filledResume.WorkExperiences = workExperiences; filledResume.Portfolios = viewModel.Portfolios; filledResume.MilitaryStatus = viewModel.MilitaryStatus; filledResume.AdditionalInfo = viewModel.AdditionalInfo; filledResume.Recommendations = viewModel.Recommendations; await _editResumeService.SaveFullResumeAsync(filledResume); return(RedirectToAction(nameof(ResumeReviewController.Index), "ResumeReview", new { resumeId = viewModel.ResumeId })); }
public async Task <IActionResult> Edit(int id, [Bind("WorkExepienceId,YearsSinceLastPromotion,YearsWithCurrentManager,YearsInCurrentRole,YearsAtCompany,EmployeeNumber")] WorkExperience workExperience) { if (id != workExperience.WorkExepienceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.WorkExepienceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(workExperience)); }
public async Task <IActionResult> Edit(WorkExperience model) { var header = this.Request.Headers["sec-fetch-site"]; if (header == "none") { return(RedirectToAction("Index", "Advertisement")); } if (ModelState.IsValid) { WorkExperience entity = db.WorkExperiences.FirstOrDefault(e => e.Id == model.Id); entity.CompanyName = model.CompanyName; entity.StartYear = model.StartYear; entity.EndYear = model.EndYear; entity.Title = model.Title; entity.Description = model.Description; db.Update <WorkExperience>(entity); await db.SaveChangesAsync(); toastNotification.AddSuccessToastMessage("Work Experience Updated !", new NotyOptions { Theme = "metroui", Timeout = 1500, Layout = "topCenter" }); } return(PartialView("_Edit", model)); }
public IActionResult AddWorkDetails(int?id, WorkExperience wca) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } // retreive the target course from static field int?ApplicantId_ = HttpContext.Session.GetInt32(sessionId_); // this works too // int courseId_ = (int)TempData[sessionId_]; var appli = context_.Applicant.Find(ApplicantId_); if (appli != null) { if (appli.academs == null) // doesn't have any lectures yet { List <WorkExperience> acade = new List <WorkExperience>(); appli.work = acade; } appli.work.Add(wca); try { context_.SaveChanges(); } catch (Exception) { // do nothing for now } } return(RedirectToAction("Index")); }
public async Task <IActionResult> Edit(int id, [Bind("WorkID,Position,Area,StartYear,EndYear,YearOfExperience,Description,UserID")] WorkExperience workExperience) { if (id != workExperience.WorkID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.WorkID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserID"] = new SelectList(_context.Users, "UserID", "UserID", workExperience.UserID); return(View(workExperience)); }
public JsonResult deleteWorkExperience(int id) { WorkExperience toDelete = db.WorkExperiences.Where(a => a.id.Equals(id)).FirstOrDefault(); db.WorkExperiences.Remove(toDelete); try { db.SaveChanges(); } catch (DbEntityValidationException e) { string message1 = e.StackTrace; foreach (var eve in e.EntityValidationErrors) { message1 += eve.Entry.State + "\n"; foreach (var ve in eve.ValidationErrors) { message1 += String.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); message1 += "\n"; } } return(Json(new { Message = message1, JsonRequestBehavior.AllowGet })); } string message = "SUCCESS"; return(Json(new { Message = message, JsonRequestBehavior.AllowGet })); }
public async Task <IActionResult> Edit(int id, [Bind("WorkExperienceId,CompanyName,JobTitle,WorkYears,CvId")] WorkExperience workExperience) { if (id != workExperience.WorkExperienceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.WorkExperienceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CvId"] = new SelectList(_context.Cvs, "CvId", "CvId", workExperience.CvId); return(View(workExperience)); }
public string AddOrUpdateExperience(WorkExperience workExperience, int idPer) { string msg = string.Empty; Person personEntity = _dbContext.People.Find(idPer); if (personEntity != null) { if (workExperience.IDExp > 0) { //we will update work experience entity _dbContext.Entry(workExperience).State = EntityState.Modified; _dbContext.SaveChanges(); msg = "Work Experience entity has been updated successfully"; } else { // we will add new work experience entity personEntity.WorkExperiences.Add(workExperience); _dbContext.SaveChanges(); msg = "Work Experience entity has been Added successfully"; } } return(msg); }
public async Task <IActionResult> Edit(int id, [Bind("WorkExperienceId,Durée,EndDate,Entreprise,Position,StartDate,idUser,photo")] WorkExperience workExperience) { if (id != workExperience.WorkExperienceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(workExperience.WorkExperienceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["idUser"] = new SelectList(_context.AppUSers, "Id", "Id", workExperience.idUser); return(View(workExperience)); }
public string AddOrUpdateExperience(WorkExperience workExperience, int IdPerson) { string msg = ""; Person person = DB.People.Find(IdPerson); if (person != null) { if (workExperience.IDexperience > 0) { DB.Entry(workExperience).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); msg = "Work Experience Updated"; } else { person.WorkExperiences.Add(workExperience); DB.SaveChanges(); msg = "work Experience Added"; } } return(msg); //throw new NotImplementedException(); }
protected void btnWorkExpDelete_Click(object sender, EventArgs e) { try { _presenter.CurrentAppUser.Employee.RemoveWorkExperience(Convert.ToInt32(Session["workExpId"])); WorkExperience delWorkExp = _presenter.GetWorkExperience(Convert.ToInt32(Session["workExpId"])); if (delWorkExp != null) { _presenter.DeleteWorkExperience(delWorkExp); } _presenter.SaveOrUpdateEmployee(_presenter.CurrentAppUser); Session["workExpId"] = null; //Clear the fields clearWorkExperiences(); BindWorkExperiences(); btnWorkExpDelete.Enabled = false; Master.ShowMessage(new AppMessage("Work Experience Is Successfully Deleted!", RMessageType.Info)); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "movetowork();", true); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: While Deleting Work Experience!", RMessageType.Error)); ExceptionUtility.LogException(ex, ex.Source); ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName); } }
public IActionResult EditWorkDetails(int?id, WorkExperience lct) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } var adp = context_.WorkEx.Find(id); if (adp != null) { adp.Company = lct.Company; adp.JobTitle = lct.JobTitle; adp.No_Of_Years = lct.No_Of_Years; adp.Responsibilites = lct.Responsibilites; adp.Technologies_Used = lct.Technologies_Used; try { context_.SaveChanges(); } catch (Exception) { // do nothing for now } } return(RedirectToAction("ReviewApplication")); }
public async Task <IActionResult> PutWorkExperience([FromRoute] int id, [FromBody] WorkExperience workExperience) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != workExperience.WorkId) { return(BadRequest()); } _context.Entry(workExperience).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkExperienceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override string ToString() { string tmp = FIO + "\n\n" + "Образование:\n" + Education.GetEducationInfo() + "\n\n" + "Опыт работы:\n" + WorkExperience.GetInfo(); return(tmp); }
//更新用户工作经历 public bool Update(WorkExperience wex) { try { if (wex != null) { WorkExperience newwex = dbcontext.WorkExperienceContext.Find(wex.WorkExperienceID); //newwex.WorkExperienceID = wex.WorkExperienceID; newwex.PartTimeUnit = wex.PartTimeUnit; newwex.StartTime = wex.StartTime; newwex.EndTime = wex.EndTime; newwex.Post = wex.Post; newwex.JobTitle = wex.JobTitle; newwex.WorkUnit = wex.WorkUnit; newwex.SecrecyLevel = wex.SecrecyLevel; newwex.Remark = wex.Remark; newwex.UserInfoID = wex.UserInfoID; dbcontext.SaveChanges(); return(true); } else { return(false); } } catch (System.Data.SqlClient.SqlException e) { throw e; } }
private void AddExperience_Click(object sender, RoutedEventArgs e) { var startExp = userStartWorkExp.SelectedDate; var endExp = userEndWorkExp.SelectedDate; var company = userCompanyExp.Text; var description = userDescriptionExp.Text; if (WorkExperience.Validate(startExp, company, endExp, description)) { if (repo.CurrentExperience == null) { var experience = new WorkExperience { Company = company, Description = description, EndDate = endExp, StartDate = (DateTime)startExp }; repo.AddNewExperience(experience); } else { repo.UpdateExperience((DateTime)startExp, company, endExp, description); repo.CurrentExperience = null; } repo.SaveConfig(); this.Close(); } else { textIncorrectData.Text = "Введены неправильные данные"; } }
public Manager(Guid id, string name, string surname,WorkExperience work, string address, string phone, string login, string password) : base(id) { Name = name; Surname = surname; Address = address; Phone = phone; Login = login; Password = password; Work = work; }
/// <summary> /// 更新工作经历 /// </summary> /// <param name="workExperience"><see cref="WorkExperience"/></param> public void UpdateWorkExperience(WorkExperience workExperience) { if (workExperience == null) return; workExperienceRepository.Update(workExperience); UserProfile userProfile = profileRepository.Get(workExperience.UserId); EventBus<UserProfile>.Instance().OnAfter(userProfile, new CommonEventArgs(EventOperationType.Instance().Update())); }
/// <summary> /// 添加工作经历 /// </summary> /// <param name="workExperience"><see cref="WorkExperience"/></param> /// <returns>创建成功返回true,否则返回false</returns> public bool CreateWorkExperience(WorkExperience workExperience) { if (workExperience == null) return false; long affectId = Convert.ToInt64(workExperienceRepository.Insert(workExperience)); UserProfile userProfile = profileRepository.Get(workExperience.UserId); EventBus<UserProfile>.Instance().OnAfter(userProfile, new CommonEventArgs(EventOperationType.Instance().Update())); if (affectId > 0) { profileRepository.UpdateIntegrity(workExperience.UserId); return true; } return false; }