コード例 #1
0
        public override Task <Empty> DeleteCompanyJob(CompanyJobPayload request, ServerCallContext context)
        {
            CompanyJobPoco poco = _logic.Get(Guid.Parse(request.Id));

            _logic.Delete(new CompanyJobPoco[] { poco });
            return(new Task <Empty>(() => new Empty()));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Company,ProfileCreated,IsInactive,IsCompanyHidden")] CompanyJobPoco companyJobPoco)
        {
            if (id != companyJobPoco.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(companyJobPoco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyJobPocoExists(companyJobPoco.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Company"] = new SelectList(_context.CompanyProfiles, "Id", "Id", companyJobPoco.Company);
            return(View(companyJobPoco));
        }
コード例 #3
0
        public ActionResult JobDetails(Guid?id)
        {
            CompanyJobPoco companyJobPoco = null;

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (TempData["ListJobsModelPerCompany"] != null)
            {
                IEnumerable <CompanyJobPoco> companyJobList = (IEnumerable <CompanyJobPoco>)TempData["ListJobsModelPerCompany"];
                companyJobPoco = companyJobList.Where(c => c.Id == id).FirstOrDefault();
                if (companyJobPoco == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                TempData.Keep("ListJobsModelPerCompany");
            }
            else
            {
                IDataRepository <CompanyJobPoco> repoCompanyJob = new MvcLogic <CompanyJobPoco>().Repo;
                companyJobPoco = repoCompanyJob.GetSingle(c => c.Id == id);

                if (companyJobPoco == null)
                {
                    return(HttpNotFound());
                }
            }
            if (TempData["JobDetailsModelPerCompany"] == null)
            {
                TempData["JobDetailsModelPerCompany"] = companyJobPoco;
            }
            return(View(companyJobPoco));
        }
コード例 #4
0
        public ActionResult Delete(Guid id)
        {
            var request = new
                          RestRequest($"api/careercloud/company/v1/job/{id}");

            var response = _client.Execute <CompanyJobPoco>(request);

            var companyJob =
                JsonConvert.DeserializeObject <CompanyJobPoco>(response.Content);

            CompanyJobPoco[] pocos = new CompanyJobPoco[]
            { companyJob };

            var deleteRequest = new
                                RestRequest("api/careercloud/company/v1/job", Method.DELETE)
            {
                RequestFormat = DataFormat.Json
            };

            deleteRequest.AddBody(pocos);

            _client.Execute(deleteRequest);

            return(View("Index"));
        }
コード例 #5
0
        public override Task <CompanyJobReply> GetCompanyJob(IdRequest4 request,
                                                             ServerCallContext context)
        {
            CompanyJobPoco poco = _logic.Get(Guid.Parse(request.Id));

            return(Task.FromResult <CompanyJobReply>(FromPoco(poco)));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "ProfileCreated,IsInactive,IsCompanyHidden")] CompanyJobPoco poco)
        {
            var companyId = Session["Company"];

            poco.Company = (Guid)companyId;
            CompanyJobPoco[] pocos = new CompanyJobPoco[] { poco };
            var request            = new RestRequest("api/careercloud/company/v1/job", Method.POST);

            request.AddJsonBody(pocos);
            request.RequestFormat = DataFormat.Json;
            var response = client.Execute(request);


            //Get Job
            //Get Back The Job just saved and add to session

            CompanyJobRepository repository = new CompanyJobRepository();
            CompanyJobLogic      logic      = new CompanyJobLogic(repository);
            var companyJob = logic.GetAll().Where(s => s.Company == poco.Company).FirstOrDefault();

            if (Session["Job"] == null)
            {
                Session["Job"] = companyJob.Id;
            }

            return(RedirectToAction("JobDescription"));
        }
コード例 #7
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyJobPoco companyJobPoco = companyJobLogic.Get(id); //db.CompanyJobs.Find(id);

            compJobPoco[0] = companyJobPoco;
            companyJobLogic.Delete(compJobPoco);
            return(RedirectToAction("Index"));
        }
コード例 #8
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyJobPoco companyJobPoco = db.CompanyJobs.Find(id);

            db.CompanyJobs.Remove(companyJobPoco);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #9
0
ファイル: Company.cs プロジェクト: hirnips/HumberAssignment1
        public CompanyJobPoco GetSingleCompanyJob(string Id)
        {
            var            logic          = new CompanyJobLogic(new EFGenericRepository <CompanyJobPoco>(false));
            CompanyJobPoco companyJobPoco = new CompanyJobPoco();

            companyJobPoco = logic.Get(Guid.Parse(Id));
            return(companyJobPoco);
        }
コード例 #10
0
 private CompanyJobPoco TranslateFromProto(CompanyJobObj proto, CompanyJobPoco poco)
 {
     poco.Id              = Guid.Parse(proto.Id);
     poco.Company         = Guid.Parse(proto.Company);
     poco.ProfileCreated  = proto.ProfileCreated.ToDateTime();
     poco.IsInactive      = proto.IsInactive;
     poco.IsCompanyHidden = proto.IsCompanyHidden;
     return(poco);
 }
コード例 #11
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyJobPoco companyJobPoco = _logic.Get(id); //  db.CompanyJob.Find(id);

            //db.CompanyJob.Remove(companyJobPoco);
            //db.SaveChanges();
            _logic.Delete(new CompanyJobPoco[] { companyJobPoco });
            return(RedirectToAction("Index"));
        }
コード例 #12
0
        // GET: ApplicantResume/Create
        public ActionResult Create()
        {
            CompanyJobPoco companyJobPoco = new CompanyJobPoco();

            //ViewBag.Applicant = new SelectList(db.ApplicantProfiles, "Id", "Currency");
            return(View(companyJobPoco));

            //return View();
        }
コード例 #13
0
        public ActionResult GetCompanyJob(Guid jobid)
        {
            CompanyJobPoco poco = _logic.Get(jobid);

            if (poco is null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
コード例 #14
0
        public IHttpActionResult GetCompanyJob(Guid companyJobId)
        {
            CompanyJobPoco appEdu = _logic.Get(companyJobId);

            if (appEdu == null)
            {
                return(NotFound());
            }
            return(Ok(appEdu));
        }
コード例 #15
0
 public ActionResult Edit([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden,TimeStamp")] CompanyJobPoco companyJobPoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyJobPoco).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(companyJobPoco));
 }
コード例 #16
0
        public IHttpActionResult GetCompanyJob(Guid CompanyJobId)
        {
            CompanyJobPoco companyJob = _logic.Get(CompanyJobId);

            if (companyJob == null)
            {
                return(NotFound());
            }
            return(Ok(companyJob));
        }
コード例 #17
0
        public IHttpActionResult GetCompanyJob(Guid id)
        {
            CompanyJobPoco poco = _logic.Get(id);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
コード例 #18
0
 public ActionResult Edit([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden")] CompanyJobPoco companyJobPoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyJobPoco).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Company = new SelectList(db.CompanyProfiles, "Id", "CompanyWebsite", companyJobPoco.Company);
     return(View(companyJobPoco));
 }
コード例 #19
0
 private CompanyJobReply FromPoco(CompanyJobPoco poco)
 {
     return(new CompanyJobReply()
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         IsCompanyHidden = poco.IsCompanyHidden,
         IsInactive = poco.IsInactive,
         ProfileCreated = Timestamp.FromDateTime(DateTime.SpecifyKind(poco.ProfileCreated, DateTimeKind.Utc))
     });
 }
コード例 #20
0
        public ActionResult Create([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden,TimeStamp")] CompanyJobPoco companyJobPoco, string JobName, string JobDescriptions, string Major, int Importance, string Skill, string SkillLevel, short EImportance)
        {
            Session["Company"] = companyJobPoco.Company;
            if (ModelState.IsValid)
            {
                companyJobPoco.Id             = Guid.NewGuid();
                companyJobPoco.ProfileCreated = DateTime.Now;
                compJobPoco[0] = companyJobPoco;

                CompanyJobSkillPoco companySkillsPoco = new CompanyJobSkillPoco();
                companySkillsPoco.Id         = Guid.NewGuid();
                companySkillsPoco.Job        = companyJobPoco.Id;
                companySkillsPoco.Skill      = Skill;
                companySkillsPoco.SkillLevel = SkillLevel;
                companySkillsPoco.Importance = Importance;
                CompanyJobSkillPoco[] compJobSkillPoco = new CompanyJobSkillPoco[]
                {
                    companySkillsPoco
                };

                CompanyJobEducationPoco companyJobEducationPoco = new CompanyJobEducationPoco();
                companyJobEducationPoco.Id         = Guid.NewGuid();
                companyJobEducationPoco.Job        = companyJobPoco.Id;
                companyJobEducationPoco.Major      = Major;
                companyJobEducationPoco.Importance = EImportance;
                CompanyJobEducationPoco[] compEducationPoco = new CompanyJobEducationPoco[]
                {
                    companyJobEducationPoco
                };

                CompanyJobDescriptionPoco companyJobDescriptionPoco = new CompanyJobDescriptionPoco();
                companyJobDescriptionPoco.Id              = Guid.NewGuid();
                companyJobDescriptionPoco.Job             = companyJobPoco.Id;
                companyJobDescriptionPoco.JobName         = JobName;
                companyJobDescriptionPoco.JobDescriptions = JobDescriptions;
                CompanyJobDescriptionPoco[] compJobDescriptionPoco = new CompanyJobDescriptionPoco[]
                {
                    companyJobDescriptionPoco
                };


                companyJobLogic.Add(compJobPoco);
                companyJobSkillLogic.Add(compJobSkillPoco);
                companyJobEducationLogic.Add(compEducationPoco);
                companyJobDescriptionLogic.Add(compJobDescriptionPoco);

                //return RedirectToAction("Details", "CompanyProfile", new { id = companyJobPoco.Company });
                return(RedirectToAction("Details", "CompanyJob", new { id = companyJobPoco.Company }));
            }

            ViewBag.Company = new SelectList(companyJobLogic.GetAll(), "Company", "Company");

            return(View(companyJobPoco));
        }
コード例 #21
0
 public ActionResult Edit([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden,TimeStamp")] CompanyJobPoco companyJobPoco)
 {
     if (ModelState.IsValid)
     {
         compJobPoco[0] = companyJobPoco;
         companyJobLogic.Update(compJobPoco);
         return(RedirectToAction("Index"));
     }
     ViewBag.Company = new SelectList(companyJobLogic.GetAll(), "Company", "Company");
     return(View(companyJobPoco));
 }
コード例 #22
0
 private CompanyJobreply FromPoco(CompanyJobPoco poco)
 {
     return(new CompanyJobreply()
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         ProfileCreated = poco.ProfileCreated == null ? null : Timestamp.FromDateTime((DateTime)poco.ProfileCreated),
         IsInactive = poco.IsInactive,
         IsCompanyHidden = poco.IsCompanyHidden
     });
 }
コード例 #23
0
 private void CompanyJob_Init()
 {
     _companyJob = new CompanyJobPoco()
     {
         Id              = Guid.NewGuid(),
         Company         = _companyProfile.Id,
         IsCompanyHidden = false,
         IsInactive      = false,
         ProfileCreated  = Faker.Date.Past()
     };
 }
コード例 #24
0
        public override Task <CompanyJobObj> GetCompanyJob(IdRequestCompanyJob request, ServerCallContext context)
        {
            var            _logic = new CompanyJobLogic(new EFGenericRepository <CompanyJobPoco>());
            CompanyJobPoco poco   = _logic.Get(Guid.Parse(request.Id));

            if (poco == null)
            {
                throw new ArgumentOutOfRangeException();
            }
            return(TranslateFromPoco(poco));
        }
コード例 #25
0
 private Task <CompanyJobObj> TranslateFromPoco(CompanyJobPoco poco)
 {
     return(Task.FromResult(new CompanyJobObj
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         ProfileCreated = Timestamp.FromDateTime(DateTime.SpecifyKind(poco.ProfileCreated, DateTimeKind.Utc)),
         IsInactive = poco.IsInactive,
         IsCompanyHidden = poco.IsCompanyHidden
     }));
 }
コード例 #26
0
 private CompanyJobReply FromPoco(CompanyJobPoco poco)
 {
     return(new CompanyJobReply()
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         ProfileCreated = Timestamp.FromDateTime(DateTime.SpecifyKind((DateTime)poco.ProfileCreated, DateTimeKind.Utc)),
         IsInactive = (bool)poco.IsInactive,
         IsCompanyHidden = (bool)poco.IsCompanyHidden,
         TimeStamp = ByteString.CopyFrom(poco.TimeStamp)
     });
 }
コード例 #27
0
        public ActionResult Create([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden,TimeStamp")] CompanyJobPoco companyJobPoco)
        {
            if (ModelState.IsValid)
            {
                companyJobPoco.Id = Guid.NewGuid();
                db.CompanyJobPocoes.Add(companyJobPoco);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(companyJobPoco));
        }
コード例 #28
0
        public async Task <IActionResult> Create([Bind("Id,Company,ProfileCreated,IsInactive,IsCompanyHidden")] CompanyJobPoco companyJobPoco)
        {
            if (ModelState.IsValid)
            {
                companyJobPoco.Id = Guid.NewGuid();
                _context.Add(companyJobPoco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Company"] = new SelectList(_context.CompanyProfiles, "Id", "Id", companyJobPoco.Company);
            return(View(companyJobPoco));
        }
コード例 #29
0
        public ActionResult Create([Bind(Include = "Id,Company,ProfileCreated,IsInactive,IsCompanyHidden")] CompanyJobPoco companyJobPoco)
        {
            if (ModelState.IsValid)
            {
                companyJobPoco.Id = Guid.NewGuid();
                db.CompanyJobs.Add(companyJobPoco);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Company = new SelectList(db.CompanyProfiles, "Id", "CompanyWebsite", companyJobPoco.Company);
            return(View(companyJobPoco));
        }
コード例 #30
0
        public override Task <CompanyJobPayLoad> ReadCompanyJob(IdRequestJob request, ServerCallContext context)
        {
            CompanyJobPoco poco = _logic.Get(Guid.Parse(request.Id));

            return(new Task <CompanyJobPayLoad>(() => new  CompanyJobPayLoad()
            {
                Id = poco.Id.ToString(),
                Company = poco.Company.ToString(),
                ProfileCreated = Timestamp.FromDateTime((DateTime)poco.ProfileCreated),
                IsInactive = poco.IsInactive,
                IsCompanyHidden = poco.IsCompanyHidden
            }));
        }