public ActionResult Admin(int employeeid) { List <ExpertiseViewModel> Expertiseviewmodellist = new List <ExpertiseViewModel>(); List <Expertise> employeeexpertiselist = ExpertiseService.GetByEmployee(employeeid); using var context = new SqlLiteContext(); List <Expertise> expertiselist = context.Expertises.ToList(); foreach (Expertise t in expertiselist) { ExpertiseViewModel evm = new ExpertiseViewModel(); evm.ExpertiseId = t.ExpertiseId; evm.EmployeeId = employeeid; evm.Name = t.Name; foreach (Expertise te in employeeexpertiselist) { if (t.ExpertiseId == te.ExpertiseId) { evm.Connected = true; } } Expertiseviewmodellist.Add(evm); } var sortedlist = Expertiseviewmodellist.OrderBy(foo => foo.Name).ToList(); var arv = new BindEmployeeExpertiseViewModel(sortedlist); return(View(arv)); }
public ActionResult <ObjectResult> Tree() { try { List <Model.Expertise.Entity.Expertise> expertises = new List <Model.Expertise.Entity.Expertise>(); ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); expertises = expertiseService.GetTree(); return(StatusCode((int)HttpStatusCode.OK, expertises)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public ActionResult <ObjectResult> ByCompany(int idCompany) { try { List <Model.Expertise.Entity.Expertise> expertises = new List <Model.Expertise.Entity.Expertise>(); ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); expertises = expertiseService.ListByCompany(new Model.Profile.Company.Entity.Company() { Id = idCompany }); return(StatusCode((int)HttpStatusCode.OK, expertises)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public ActionResult <ObjectResult> Specific(int idExpertise) { try { Model.Expertise.Entity.Expertise expertise = new Model.Expertise.Entity.Expertise(); ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); expertise = expertiseService.Get(new Model.Expertise.Entity.Expertise() { IdExpertise = idExpertise }); return(StatusCode((int)HttpStatusCode.OK, expertise)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public ActionResult <ObjectResult> RemoveCompanyAssociation([FromBody] CompanyAssociation companyAssociation) { try { ExpertiseService expertiseService = new ExpertiseService(Startup.BeePlaceDataBaseConnectionString); var company = new Model.Profile.Company.Entity.Company() { Id = companyAssociation.IdCompany }; var expertise = new Model.Expertise.Entity.Expertise() { IdExpertise = companyAssociation.IdExpertise }; expertiseService.RemoveCompanyAssociation(company, expertise); return(StatusCode((int)HttpStatusCode.OK, companyAssociation)); } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public List <ExpertiseViewModel> GetExpertiseView(int employee) { List <ExpertiseViewModel> ExpertiseViewModels = new List <ExpertiseViewModel>(); List <Expertise> targetData = ExpertiseService.GetByEmployee(employee); if (targetData != null) { foreach (Expertise target in targetData) { ExpertiseViewModel evm = new ExpertiseViewModel { ExpertiseId = target.ExpertiseId, Name = target.Name }; ExpertiseViewModels.Add(evm); } } return(ExpertiseViewModels); }