public async Task <ActionResult <LanguageSkill> > PostLanguageSkill(LanguageSkill languageSkill) { _context.LanguageSkills.Add(languageSkill); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLanguageSkill", new { id = languageSkill.Id }, languageSkill)); }
public async Task <IActionResult> PutLanguageSkill(int id, LanguageSkill languageSkill) { if (id != languageSkill.Id) { return(BadRequest()); } _context.Entry(languageSkill).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LanguageSkillExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public LanguageSkillDTO(LanguageSkill langSkill) { Id = langSkill.Id; EditTime = langSkill.EditTime; State = langSkill.State; LanguageId = langSkill.Language == null ? 0 : langSkill.Language.Id; LanguageLevel = langSkill.LanguageLevel; }
private static void CreateNewLanguageSkills(Candidate destination, CandidateDTO source) { source.LanguageSkills.Where(x => x.IsNew()).ToList().ForEach(newLanguageSkill => { var toDomain = new LanguageSkill(); toDomain.Update(newLanguageSkill); destination.LanguageSkills.Add(toDomain); }); }
public ActionResult SaveLanguage() { DAL.DataContext dt = new DAL.DataContext(); int lang_id = Int32.Parse(Request.Form["lang"]); int level = Int32.Parse(Request.Form["level"]); LanguageSkill lang = new LanguageSkill(); lang.Language = dt.Languages.Where(l => l.Id == lang_id).FirstOrDefault(); string user_id = User.Identity.GetUserId(); lang.User = dt.Users.Where(u => u.Id == user_id).FirstOrDefault(); lang.Level = level; dt.SecondLanguages.Add(lang); dt.SaveChanges(); return(RedirectToAction("Language", "Account")); }
private static void PerformLanguageSkillsSaving(Vacancy destination, VacancyDTO source, ILanguageSkillRepository languageSkillRepository) { var updatedLanguageSkill = source.LanguageSkill; LanguageSkill domainLanguageSkill = destination.LanguageSkill; if (destination.LanguageSkill == null) { domainLanguageSkill = destination.LanguageSkill = new LanguageSkill(); } if (updatedLanguageSkill == null) { destination.LanguageSkill = null; return; } if (updatedLanguageSkill.ShouldBeRemoved()) { languageSkillRepository.Delete(updatedLanguageSkill.Id); } else { domainLanguageSkill.Update(updatedLanguageSkill); } }
protected override void Seed(LanguageProject.DAL.DataContext context) { if (System.Diagnostics.Debugger.IsAttached == false) { System.Diagnostics.Debugger.Launch(); } // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. ApplicationRoleManager role = new ApplicationRoleManager(context); role.CreateRoles(); List <Languages> languages = Seeds.FirstDemo.Lanuages(); foreach (Languages la in languages) { var old = context.Languages.Where(s => s.Name == la.Name).FirstOrDefault(); if (old == null) { context.Languages.AddOrUpdate(la); } } context.SaveChanges(); User one = new User { UserName = "******", FName = "Paula", LName = "Caroline", Email = "*****@*****.**", NativeLang = context.Languages.Find(4), Balance = 0, Country = "Canada" }; User two = new User { UserName = "******", FName = "Debora", LName = "Mayumi", Email = "*****@*****.**", NativeLang = context.Languages.Find(5), Balance = 0, Country = "Canada" }; User admin = new User { UserName = "******", FName = "Debora", LName = "Mayumi", Email = "*****@*****.**", NativeLang = context.Languages.Find(5), Balance = 0, Country = "Canada" }; ApplicationUserManager userManager = new ApplicationUserManager(new UserStore <User>(context)); userManager.PasswordValidator = new PasswordValidator { RequiredLength = 6, RequireNonLetterOrDigit = false, RequireDigit = false, RequireLowercase = false, RequireUppercase = false, }; var create_one = userManager.Create(one, "123456"); if (create_one.Succeeded) { userManager.AddToRole(one.Id, "Teacher"); } var create_two = userManager.Create(two, "123456"); if (create_two.Succeeded) { userManager.AddToRole(two.Id, "Teacher"); } var create_admin = userManager.Create(admin, "123456"); if (create_admin.Succeeded) { userManager.AddToRole(admin.Id, "Admin"); } List <int> costs = new List <int> { 10, 19, 20, 25, 22, 18, 10 }; List <User> teachers = Seeds.FirstDemo.Teachers(); List <string> courseName = Seeds.FirstDemo.courseName; Random rnd = new Random(); foreach (User te in teachers) { var te_create = userManager.Create(te, "123456"); if (te_create.Succeeded) { userManager.AddToRole(te.Id, "Student"); } for (int i = 0; i <= 5; i++) { int r = rnd.Next(courseName.Count); int rCost = rnd.Next(costs.Count); Course course = new Course { Description = "", Language = context.Languages.Find(1), Title = courseName[rnd.Next(courseName.Count)], Cost = costs[rnd.Next(costs.Count)] }; course.Teacher = te; context.Courses.Add(course); context.SaveChanges(); } } // context.Users.Add(one); //context.Users.Add(two); //users.ForEach(s => context.Users.AddOrUpdate(s)); context.SaveChanges(); LanguageSkill language_one = new LanguageSkill { Language = languages[5], User = one, Level = 9 }; LanguageSkill langue_two = new LanguageSkill { Language = languages[4], User = two, Level = 8 }; context.SecondLanguages.AddOrUpdate(language_one); context.SecondLanguages.AddOrUpdate(langue_two); context.SaveChanges(); // Seeds.FirstDemo.Teachers(); }
public void Add_Candidate() { var _controller = new CandidatesController(new DummyRepositoryFacade()); _controller.Request = new System.Net.Http.HttpRequestMessage(); _controller.Configuration = new System.Web.Http.HttpConfiguration(); #region Candidate Comment candidateComment = new Comment() { CommentType = CommentType.Candidate, Message = "msg", RelativeId = 0, }; File candidateFile = new File() { Description = "description", FilePath = "path", }; CandidateSource candidateSource = new CandidateSource() { Path = "Path", Source = Source.HeadHunter, }; Language language = new Language() { Id = 1, Title = "language" }; LanguageSkill languageSkill = new LanguageSkill() { Language = language, LanguageLevel = LanguageLevel.Fluent, }; Country country = new Country() { Title = "name" }; Location city = new Location() { Id = 1, Country = country, Title = "dnepr" }; Photo photo = new Photo() { Description = "descr", ImagePath = "path" }; Skill skill = new Skill() { Id = 1, Title = "C#" }; SocialNetwork socialNetwork = new SocialNetwork() { Id = 1, ImagePath = "path", Title = "Path" }; CandidateSocial candidateSocial = new CandidateSocial() { Path = "path", SocialNetwork = socialNetwork, }; Candidate candidate = new Candidate() { Skype = "skype", BirthDate = DateTime.Now, Comments = new List <Comment>() { candidateComment }, Description = "descrpition", Education = "High", Email = "email", Files = new List <File>() { candidateFile }, Sources = new List <CandidateSource>() { candidateSource }, FirstName = "TESTNAME", IsMale = true, LanguageSkills = new List <LanguageSkill>() { languageSkill }, LastName = "lname", Location = city, MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber { Number = "+380978762352" } }, Photo = photo, PositionDesired = "architecht", Practice = "best", RelocationAgreement = true, SalaryDesired = 10500, Skills = new List <Skill>() { skill }, SocialNetworks = new List <CandidateSocial>() { candidateSocial }, TypeOfEmployment = TypeOfEmployment.FullTime, VacanciesProgress = new List <VacancyStageInfo>() { } }; #endregion }
public static void Update(this LanguageSkill domain, LanguageSkillDTO dto) { domain.LanguageLevel = dto.LanguageLevel; domain.LanguageId = dto.LanguageId; domain.State = dto.State; }
public DummyBotContext() { #region Candidate Comment candidateComment = new Comment() { CommentType = CommentType.Candidate, Message = "msg", RelativeId = 0, }; File candidateFile = new File() { Description = "description", FilePath = "path", }; CandidateSource candidateSource = new CandidateSource() { Path = "Path", Source = Source.HeadHunter, }; LanguageSkill languageSkill = new LanguageSkill() { Language = _languages[0], LanguageLevel = LanguageLevel.Fluent, }; Photo photo = new Photo() { Description = "descr", ImagePath = "path" }; SocialNetwork socialNetwork = new SocialNetwork() { Id = 1, ImagePath = "path", Title = "Path" }; _socialNetworks.Add(socialNetwork); CandidateSocial candidateSocial = new CandidateSocial() { Path = "path", SocialNetwork = socialNetwork, }; Candidate candidate = new Candidate() { Id = 1, Skype = "skype", BirthDate = DateTime.Now, Comments = new List <Comment>() { candidateComment }, Description = "descrpition", Education = "High", Email = "email", Industry = industries[0], StartExperience = DateTime.Now, Tags = new List <Tag>() { _tags[0] }, Files = new List <File>() { candidateFile }, Sources = new List <CandidateSource>() { candidateSource }, FirstName = "TESTNAME", IsMale = true, LanguageSkills = new List <LanguageSkill>() { languageSkill }, LastName = "lname", Location = _locations[0], MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber() { Id = 1, Number = "+380978762352" } }, Photo = photo, PositionDesired = "architecht", Practice = "best", RelocationAgreement = true, SalaryDesired = 10500, Skills = new List <Skill>() { _skills[0] }, SocialNetworks = new List <CandidateSocial>() { candidateSocial }, TypeOfEmployment = TypeOfEmployment.FullTime, VacanciesProgress = new List <VacancyStageInfo>() { } }; #endregion Comment vacancyComment = new Comment() { CommentType = CommentType.Vacancy, Message = "msg", RelativeId = 0, }; File vacancyFile = new File() { Description = "file", FilePath = "path", }; Permission permission = new Permission() { Id = 1, AccessRights = AccessRights.AddCandidateToVacancy, Description = "Permis", }; Role role = new Role() { Id = 1, Title = "adm", Permissions = new List <Permission>() { permission }, }; User user = new User() { Id = 1, BirthDate = DateTime.Now, Email = "mail", FirstName = "fname", isMale = true, LastName = "lastname", Location = _locations[0], Login = "******", Password = "******", MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber() { Number = "+3565234662" } }, Photo = photo, Role = role, Skype = "skype", }; Vacancy vacancy = new Vacancy() { Id = 1, TypeOfEmployment = TypeOfEmployment.FullTime, Title = "Architecht", Comments = new List <Comment>() { vacancyComment }, DeadlineDate = DateTime.Now, Description = "descr", EndDate = DateTime.Now, Files = new List <File>() { vacancyFile }, LanguageSkill = languageSkill, Level = new List <Level>() { Level.Senior }, Locations = new List <Location>() { _locations[0] }, ParentVacancy = null, RequiredSkills = new List <Skill>() { _skills[0] }, Responsible = user, SalaryMax = 100500, SalaryMin = 15, StartDate = DateTime.Now, Department = _departments[0], CandidatesProgress = new List <VacancyStageInfo>() }; Comment vsicomment = new Comment() { CommentType = CommentType.StageInfo, Message = "msg", RelativeId = 0, }; VacancyStage vs = new VacancyStage() { IsCommentRequired = true, Order = 1, Stage = _stages[0], Vacacny = vacancy }; VacancyStageInfo vsi = new VacancyStageInfo() { Candidate = candidate, Comment = vsicomment, VacancyStage = vs }; candidate.VacanciesProgress.Add(vsi); vacancy.CandidatesProgress.Add(vsi); _vacancies.Add(vacancy); _candidates.Add(candidate); }
protected override void Seed(Data.EFData.BOTContext context) { List <Skill> skills = new List <Skill>() { new Skill { Title = "SQL" }, new Skill { Title = "WinForms" }, new Skill { Title = "DevExpress" }, new Skill { Title = ".Net" }, new Skill { Title = "C#" }, new Skill { Title = "Spring .Net" }, new Skill { Title = "JQuery" }, new Skill { Title = "JavaScript" }, new Skill { Title = "ASP .NET MVC" }, new Skill { Title = "HTML5+CSS3" }, new Skill { Title = "NHibernate" }, new Skill { Title = "Entity Framework" } }; context.Skills.AddRange(skills); context.SaveChanges(); List <Tag> tags = new List <Tag>() { new Tag { Title = "SQL" }, new Tag { Title = "WinForms" }, new Tag { Title = "DevExpress" }, new Tag { Title = ".Net" }, new Tag { Title = "C#" }, new Tag { Title = "Spring .Net" }, new Tag { Title = "JQuery" }, new Tag { Title = "JavaScript" }, new Tag { Title = "ASP .NET MVC" }, new Tag { Title = "HTML5+CSS3" }, new Tag { Title = "NHibernate" }, new Tag { Title = "Entity Framework" } }; context.Tags.AddRange(tags); context.SaveChanges(); List <Industry> industries = new List <Industry>() { new Industry { Title = "IT" }, new Industry { Title = "Accounting" }, new Industry { Title = "Administration" } }; context.Industries.AddRange(industries); context.SaveChanges(); List <Role> roles = new List <Role>() { new Role { Title = "Manager" }, new Role { Title = "Recruiter" }, new Role { Title = "Freelancer" } }; context.Roles.AddRange(roles); context.SaveChanges(); List <DepartmentGroup> departmentGroups = new List <DepartmentGroup>() { new DepartmentGroup { Title = "Contract" }, new DepartmentGroup { Title = "Nonprod" }, new DepartmentGroup { Title = "Prod" } }; context.DepartmentGroups.AddRange(departmentGroups); context.SaveChanges(); List <Department> departments = new List <Department>() { new Department { Title = "Contract Programming", DepartmentGroup = departmentGroups[0] }, new Department { Title = "Sites Design", DepartmentGroup = departmentGroups[0] }, new Department { Title = "Web apps", DepartmentGroup = departmentGroups[0] }, new Department { Title = "Accounting", DepartmentGroup = departmentGroups[1] }, new Department { Title = "Administration", DepartmentGroup = departmentGroups[1] }, new Department { Title = "Executives", DepartmentGroup = departmentGroups[1] }, new Department { Title = "DevWorkshop", DepartmentGroup = departmentGroups[1] }, new Department { Title = "HR", DepartmentGroup = departmentGroups[1] }, new Department { Title = "Managers", DepartmentGroup = departmentGroups[1] }, new Department { Title = "Managers", DepartmentGroup = departmentGroups[2] }, new Department { Title = "QA", DepartmentGroup = departmentGroups[2] }, new Department { Title = "UPM", DepartmentGroup = departmentGroups[2] }, new Department { Title = "EPE", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Soft Web", DepartmentGroup = departmentGroups[2] }, new Department { Title = "AR", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Bank/Donor", DepartmentGroup = departmentGroups[2] }, new Department { Title = "iTMS", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics 1", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics 2", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics 3", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics 5", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics Analysts", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics Autotesting", DepartmentGroup = departmentGroups[2] }, new Department { Title = "HLA", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Portal", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Regr.Testing", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Total QC", DepartmentGroup = departmentGroups[2] }, new Department { Title = "CM", DepartmentGroup = departmentGroups[2] }, new Department { Title = "DBA", DepartmentGroup = departmentGroups[2] }, new Department { Title = "MIS Tech Support", DepartmentGroup = departmentGroups[2] }, new Department { Title = "SA", DepartmentGroup = departmentGroups[2] }, new Department { Title = "SE", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Architects", DepartmentGroup = departmentGroups[2] }, new Department { Title = "BI", DepartmentGroup = departmentGroups[2] }, new Department { Title = "CSF", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Interfaces", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Lab 5.0", DepartmentGroup = departmentGroups[2] }, new Department { Title = "LabMic", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Mic 5.0", DepartmentGroup = departmentGroups[2] }, new Department { Title = "RNV", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Reports", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Genetics Support", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Support", DepartmentGroup = departmentGroups[2] }, new Department { Title = "Update", DepartmentGroup = departmentGroups[2] }, }; context.Departments.AddRange(departments); context.SaveChanges(); List <Language> languages = new List <Language>() { new Language { Title = "English" }, new Language { Title = "Polish" } }; context.Languages.AddRange(languages); context.SaveChanges(); List <Country> countries = new List <Country>() { new Country { Title = "Ukraine" } }; context.Countries.AddRange(countries); context.SaveChanges(); List <Location> locations = new List <Location>() { new Location { Country = countries[0], Title = "Kiev" }, new Location { Country = countries[0], Title = "Kharkiv" }, new Location { Country = countries[0], Title = "Odessa" }, new Location { Country = countries[0], Title = "Dnipropetrovsk" }, new Location { Country = countries[0], Title = "Zaporizhia" }, new Location { Country = countries[0], Title = "Lviv" }, new Location { Country = countries[0], Title = "Kryvyi Rih" }, new Location { Country = countries[0], Title = "Mykolaiv" }, new Location { Country = countries[0], Title = "Mariupol" }, new Location { Country = countries[0], Title = "Luhansk" }, new Location { Country = countries[0], Title = "Donetsk" }, new Location { Country = countries[0], Title = "Sevastopol" }, new Location { Country = countries[0], Title = "Vinnytsia" }, new Location { Country = countries[0], Title = "Makiivka" }, new Location { Country = countries[0], Title = "Simferopol" }, new Location { Country = countries[0], Title = "Kherson" }, new Location { Country = countries[0], Title = "Poltava" }, new Location { Country = countries[0], Title = "Chernihiv" }, }; context.Locations.AddRange(locations); context.SaveChanges(); List <Stage> stages = new List <Stage>() { new Stage { Title = "Pool" }, new Stage { Title = "Selected" }, new Stage { Title = "HR Interview" }, new Stage { Title = "Test task" }, new Stage { Title = "Tech Interview" }, new Stage { Title = "Additional interview" }, new Stage { Title = "Final Interview", }, new Stage { Title = "Job Offer Issued" }, new Stage { Title = "Job Offer Accepted", }, new Stage { Title = "Hired" }, new Stage { Title = "Rejected" }, }; context.Stages.AddRange(stages); context.SaveChanges(); Comment vacancyComment = new Comment() { CommentType = CommentType.Vacancy, Message = "Messg", RelativeId = 0 }; File vFile = new File() { Description = "desc", FilePath = "path" }; LanguageSkill languageSkill = new LanguageSkill() { Language = context.Languages.First(), LanguageLevel = LanguageLevel.Advanced }; Photo photo = new Photo() { Description = "desc", ImagePath = "path" }; User user = new User() { BirthDate = DateTime.Now, Email = "email", FirstName = "fname", isMale = true, LastName = "lastname", Location = context.Locations.First(), Login = "******", Password = "******", MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber() { Number = "+3565234662" } }, Photo = photo, Role = context.Roles.First(), Skype = "skype", }; context.Users.Add(user); context.SaveChanges(); Tag tag = new Tag() { Title = "tag" }; context.Tags.Add(tag); context.SaveChanges(); Vacancy vacancy = new Vacancy() { Industry = context.Industries.First(), TypeOfEmployment = TypeOfEmployment.FullTime, Title = "Architecht", Comments = new List <Comment>() { vacancyComment }, DeadlineDate = DateTime.Now, Description = "descr", EndDate = DateTime.Now, Files = new List <File>() { vFile }, LanguageSkill = languageSkill, Level = new List <Level>() { Level.Senior }, Locations = new List <Location> { context.Locations.First() }, ParentVacancy = null, RequiredSkills = new List <Skill>() { context.Skills.First() }, Responsible = context.Users.First(), SalaryMax = 100500, SalaryMin = 15, StartDate = DateTime.Now, Department = context.Departments.First(), CandidatesProgress = new List <VacancyStageInfo>(), Tags = new List <Tag>() { context.Tags.First() }, }; Candidate candidate = new Candidate() { BirthDate = DateTime.Now, Comments = new List <Comment> { }, Education = "Good", FirstName = "Jonny", Industry = context.Industries.First(), Description = "candidate is candi", Email = "*****@*****.**", Files = new List <File>() { }, IsMale = true, LanguageSkills = new List <LanguageSkill>() { new LanguageSkill() { Language = context.Languages.First(), LanguageLevel = LanguageLevel.Advanced } }, LastName = "Yehayy", Location = context.Locations.First(), MiddleName = "Caro", PhoneNumbers = new List <PhoneNumber>() { }, Photo = new Photo() { Description = "desc", ImagePath = "path" }, PositionDesired = "Pos", Practice = "Good", RelocationAgreement = true, SalaryDesired = 500, Skills = new List <Skill>() { context.Skills.First() }, Skype = "skyper133", SocialNetworks = new List <CandidateSocial>() { new CandidateSocial() { Path = "path", SocialNetwork = new SocialNetwork() { ImagePath = "imgPath", Title = "title" } } }, Sources = new List <CandidateSource>() { new CandidateSource() { Source = Source.WorkUa, Path = "Path" } }, StartExperience = DateTime.Now, Tags = new List <Tag>() { context.Tags.First() }, TypeOfEmployment = TypeOfEmployment.FullTime, VacanciesProgress = new List <VacancyStageInfo>() { } }; context.Candidates.Add(candidate); context.SaveChanges(); Comment comment = new Comment() { CommentType = CommentType.Candidate, Message = "Good paren'", RelativeId = context.Candidates.First().Id, }; context.Candidates.First().Comments.Add(comment); context.SaveChanges(); context.Vacancies.Add(vacancy); /* context.Candidates.Add(candidate); * context.Locations.AddRange(locations); * context.Countries.AddRange(countries); * context.Stages.AddRange(stages);*/ context.SaveChanges(); base.Seed(context); }