コード例 #1
0
        public ActionResult Create([Bind(Include = "Id,RegistrationDate,CompanyWebsite,ContactPhone,ContactName,CompanyLogo,TimeStamp")] CompanyProfilePoco companyProfilePoco, string LanguageId, string CompanyName, string CompanyDescription)
        {
            if (ModelState.IsValid)
            {
                companyProfilePoco.Id = Guid.NewGuid();
                compProfilePoco[0]    = companyProfilePoco;
                companyProfileLogic.Add(compProfilePoco);


                CompanyDescriptionPoco companyDescriptionPoco = new CompanyDescriptionPoco();
                companyDescriptionPoco.Id                 = Guid.NewGuid();
                companyDescriptionPoco.Company            = companyProfilePoco.Id;
                companyDescriptionPoco.LanguageId         = LanguageId;
                companyDescriptionPoco.CompanyName        = CompanyName;
                companyDescriptionPoco.CompanyDescription = CompanyDescription;
                CompanyDescriptionPoco[] companyDescriptionPocos = new CompanyDescriptionPoco[] {
                    companyDescriptionPoco
                };
                companyDescriptionLogic.Add(companyDescriptionPocos);


                ViewBag.LanguageId = new SelectList(companyLogic.GetLanguage(), "LanguageId", "Name", companyDescriptionPoco.LanguageId);
                return(RedirectToAction("Details", new { id = companyProfilePoco.Id }));
            }

            return(View(companyProfilePoco));
        }
コード例 #2
0
        public async Task <IActionResult> Create(CompanyDetails companyDetails)
        {
            if (ModelState.IsValid)
            {
                var config = new MapperConfiguration(cfg => { cfg.CreateMap <CompanyProfile, CompanyProfilePoco>();
                                                              cfg.CreateMap <CompanyDescriptionModel, CompanyDescriptionPoco>(); });
                var mapper = config.CreateMapper();
                CompanyProfilePoco companyProfilePoco = mapper.Map <CompanyProfilePoco>(companyDetails.companyProfile);
                companyProfilePoco.Id = Guid.NewGuid();

                CompanyDescriptionPoco companyDescriptionPoco =
                    mapper.Map <CompanyDescriptionPoco>(companyDetails.companyDescription);

                companyDescriptionPoco.Id      = Guid.NewGuid();
                companyDescriptionPoco.Company = companyProfilePoco.Id;
                var lang = _context.SystemLanguageCodes.Where(l => l.Name == companyDetails.companyDescription.LanguageId).FirstOrDefault();
                companyDescriptionPoco.LanguageId = lang.LanguageID;
                _context.Add(companyProfilePoco);
                _context.Add(companyDescriptionPoco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Details), new { id = companyProfilePoco.Id }));
            }
            return(View(companyDetails));
        }
コード例 #3
0
        public void DeleteJobDescription(Guid ID)
        {
            companyDescriptionRepo = new EFGenericRepository <CompanyDescriptionPoco>();


            CompanyDescriptionPoco companyDescriptionPoco = new CompanyDescriptionPoco();

            companyDescriptionPoco = companyDescriptionRepo.GetSingle(c => c.Company.Equals(ID));
            CompanyDescriptionPoco[] CompanyDescriptionPocos = new CompanyDescriptionPoco[]
            {
                companyDescriptionPoco
            };

            companyDescriptionRepo.Remove(CompanyDescriptionPocos);


            companyProfileRepo = new EFGenericRepository <CompanyProfilePoco>();
            CompanyProfilePoco companyProfilePoco = new CompanyProfilePoco();

            companyProfilePoco = companyProfileRepo.GetSingle(c => c.Id.Equals(ID));
            CompanyProfilePoco[] companyProfilePocos = new CompanyProfilePoco[]
            {
                companyProfilePoco
            };
            companyProfileRepo.Remove(companyProfilePocos);
        }
コード例 #4
0
        public override Task <CompanyDescriptionReply> GetCompanyDescription(IdRequest3 request,
                                                                             ServerCallContext context)
        {
            CompanyDescriptionPoco poco = _logic.Get(Guid.Parse(request.Id));

            return(Task.FromResult <CompanyDescriptionReply>(FromPoco(poco)));
        }
コード例 #5
0
        public override Task <Empty> DeleteCompanyDescription(CompanyDescriptionPayload request, ServerCallContext context)
        {
            CompanyDescriptionPoco poco = _logic.Get(Guid.Parse(request.Id));

            _logic.Delete(new CompanyDescriptionPoco[] { poco });
            return(new Task <Empty>(() => new Empty()));
        }
コード例 #6
0
        public ActionResult Delete(Guid id)
        {
            var request = new
                          RestRequest($"api/careercloud/company/v1/description/{id}");

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

            var companyDescription =
                JsonConvert.DeserializeObject <CompanyDescriptionPoco>(response.Content);

            CompanyDescriptionPoco[] pocos = new CompanyDescriptionPoco[]
            { companyDescription };

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

            deleteRequest.AddBody(pocos);

            _client.Execute(deleteRequest);

            return(View("Index"));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Company,LanguageId,CompanyName,CompanyDescription")] CompanyDescriptionPoco companyDescriptionPoco)
        {
            if (id != companyDescriptionPoco.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(companyDescriptionPoco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyDescriptionPocoExists(companyDescriptionPoco.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Company"]    = new SelectList(_context.CompanyProfiles, "Id", "Id", companyDescriptionPoco.Company);
            ViewData["LanguageId"] = new SelectList(_context.SystemLanguageCodes, "LanguageID", "LanguageID", companyDescriptionPoco.LanguageId);
            return(View(companyDescriptionPoco));
        }
コード例 #8
0
ファイル: Company.cs プロジェクト: hirnips/HumberAssignment1
        public CompanyDescriptionPoco GetSingleCompanyDescription(string Id)
        {
            var logic = new CompanyDescriptionLogic(new EFGenericRepository <CompanyDescriptionPoco>(false));
            CompanyDescriptionPoco companyDescriptionPoco = new CompanyDescriptionPoco();

            companyDescriptionPoco = logic.Get(Guid.Parse(Id));
            return(companyDescriptionPoco);
        }
コード例 #9
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyDescriptionPoco companyDescriptionPoco = db.CompanyDescriptions.Find(id);

            db.CompanyDescriptions.Remove(companyDescriptionPoco);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #10
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyDescriptionPoco companyDescriptionPoco = companyDescriptionLogic.Get(id); //db.CompanyDescriptions.Find(id);

            compDescriptionPoco[0] = companyDescriptionPoco;
            companyDescriptionLogic.Delete(compDescriptionPoco);

            return(RedirectToAction("Index"));
        }
コード例 #11
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyDescriptionPoco companyDescriptionPoco = _logic.Get(id);  // db.CompanyDescription.Find(id);

            //db.CompanyDescription.Remove(companyDescriptionPoco);
            //db.SaveChanges();
            _logic.Delete(new CompanyDescriptionPoco[] { companyDescriptionPoco });
            return(RedirectToAction("Index"));
        }
コード例 #12
0
        public IHttpActionResult GetCompanyDescription(Guid companyDescriptionId)
        {
            CompanyDescriptionPoco poco = _logic.Get(companyDescriptionId);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
コード例 #13
0
        public ActionResult GetCompanyDescription(Guid descriptionid)
        {
            CompanyDescriptionPoco poco = _logic.Get(descriptionid);

            if (poco is null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
コード例 #14
0
        public IHttpActionResult GetCompanyDescription(Guid CompanyDescriptionId)
        {
            CompanyDescriptionPoco companyDescription = _logic.Get(CompanyDescriptionId);

            if (companyDescription == null)
            {
                return(NotFound());
            }
            return(Ok(companyDescription));
        }
コード例 #15
0
 private CompanyDescriptionReply FromPoco(CompanyDescriptionPoco poco)
 {
     return(new CompanyDescriptionReply()
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         LanguageId = poco.LanguageId,
         CompanyName = poco.CompanyName,
         CompanyDescription = poco.CompanyDescription
     });
 }
コード例 #16
0
        public override Task <CompanyDescriptionObj> GetCompanyDescription(IdRequestCompanyDescription request, ServerCallContext context)
        {
            var _logic = new CompanyDescriptionLogic(new EFGenericRepository <CompanyDescriptionPoco>());
            CompanyDescriptionPoco poco = _logic.Get(Guid.Parse(request.Id));

            if (poco == null)
            {
                throw new ArgumentOutOfRangeException();
            }
            return(TranslateFromPoco(poco));
        }
コード例 #17
0
 private Task <CompanyDescriptionObj> TranslateFromPoco(CompanyDescriptionPoco poco)
 {
     return(Task.FromResult(new CompanyDescriptionObj
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         LanguageId = poco.LanguageId.ToString(),
         CompanyName = poco.CompanyName,
         CompanyDescription = poco.CompanyDescription,
     }));
 }
コード例 #18
0
 private void CompanyDescription_Init()
 {
     _companyDescription = new CompanyDescriptionPoco()
     {
         Id = Guid.NewGuid(),
         CompanyDescription = Faker.Company.CatchPhrase(),
         CompanyName        = Faker.Company.CatchPhrasePos(),
         LanguageId         = _systemLangCode.LanguageID,
         Company            = _companyProfile.Id
     };
 }
コード例 #19
0
 public ActionResult Edit([Bind(Include = "Id,Company,LanguageId,CompanyName,CompanyDescription,TimeStamp")] CompanyDescriptionPoco companyDescriptionPoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyDescriptionPoco).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LanguageId = new SelectList(db.SystemLanguageCodePocoes, "LanguageID", "Name", companyDescriptionPoco.LanguageId);
     return(View(companyDescriptionPoco));
 }
コード例 #20
0
 private CompanyDescriptionReply FromPOCO(CompanyDescriptionPoco poco)
 {
     return(new CompanyDescriptionReply()
     {
         Id = poco.Id.ToString(),
         Company = poco.Company.ToString(),
         LanguageId = poco.LanguageId.ToString(),
         CompanyName = poco.CompanyName.ToString(),
         CompanyDescription = poco.CompanyDescription.ToString(),
         TimeStamp = ByteString.CopyFrom(poco.TimeStamp)
     });
 }
コード例 #21
0
 public ActionResult Edit([Bind(Include = "Id,Company,LanguageId,CompanyName,CompanyDescription,TimeStamp")] CompanyDescriptionPoco companyDescriptionPoco)
 {
     if (ModelState.IsValid)
     {
         compDescriptionPoco[0] = companyDescriptionPoco;
         companyDescriptionLogic.Update(compDescriptionPoco);
         return(RedirectToAction("Index"));
     }
     ViewBag.Company    = new SelectList(companyDescriptionLogic.GetAll(), "Company", "Company");
     ViewBag.LanguageId = new SelectList(companyDescriptionLogic.GetAll(), "LanguageId", "LanguageId");
     return(View(companyDescriptionPoco));
 }
コード例 #22
0
 public ActionResult Edit([Bind(Include = "Id,CompanyName,CompanyDescription,TimeStamp,Company,LanguageId")] CompanyDescriptionPoco companyDescriptionPoco)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(companyDescriptionPoco).State = EntityState.Modified;
         //db.SaveChanges();
         _logic.Update(new CompanyDescriptionPoco[] { companyDescriptionPoco });
         return(RedirectToAction("Index"));
     }
     ViewBag.Company    = new SelectList(db.CompanyProfile, "Id", "CompanyWebsite", companyDescriptionPoco.Company);
     ViewBag.LanguageId = new SelectList(db.SystemLanguageCode, "LanguageID", "NativeName", companyDescriptionPoco.LanguageId);
     return(View(companyDescriptionPoco));
 }
コード例 #23
0
        public ActionResult Create([Bind(Include = "Id,Company,LanguageId,CompanyName,CompanyDescription,TimeStamp")] CompanyDescriptionPoco companyDescriptionPoco)
        {
            if (ModelState.IsValid)
            {
                companyDescriptionPoco.Id = Guid.NewGuid();
                db.CompanyDescriptionPocoes.Add(companyDescriptionPoco);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.LanguageId = new SelectList(db.SystemLanguageCodePocoes, "LanguageID", "Name", companyDescriptionPoco.LanguageId);
            return(View(companyDescriptionPoco));
        }
コード例 #24
0
        public override Task <Empty> CreateCompanyDescription(CompanyDescriptionPayload request, ServerCallContext context)
        {
            CompanyDescriptionPoco[] pocos = new CompanyDescriptionPoco[1];

            pocos[0].Id                 = Guid.Parse(request.Id);
            pocos[0].Company            = Guid.Parse(request.Company);
            pocos[0].LanguageId         = request.LanguageId;
            pocos[0].CompanyName        = request.CompanyName;
            pocos[0].CompanyDescription = request.CompanyDescription;

            _logic.Add(pocos);
            return(new Task <Empty>(null));
        }
コード例 #25
0
        public override Task <CompanyDescriptionPayLoad> ReadCompanyDescription(IdRequestDescription request, ServerCallContext context)
        {
            CompanyDescriptionPoco poco = _logic.Get(Guid.Parse(request.Id));

            return(new Task <CompanyDescriptionPayLoad>(() => new CompanyDescriptionPayLoad()
            {
                Id = poco.Id.ToString(),
                Company = poco.Company.ToString(),
                LanguageId = poco.LanguageId.ToString(),
                CompanyName = poco.CompanyName,
                CompanyDescription = poco.CompanyDescription
            }));
        }
コード例 #26
0
        public async Task <IActionResult> Create([Bind("Company,LanguageId,CompanyName,CompanyDescription")] CompanyDescriptionPoco companyDescriptionPoco)
        {
            if (ModelState.IsValid)
            {
                companyDescriptionPoco.Id = Guid.NewGuid();
                _logic.Add(new CompanyDescriptionPoco[] { companyDescriptionPoco });

                return(RedirectToAction(nameof(Details), "companyprofile", new { Id = companyDescriptionPoco.Company }));
            }
            PopulateCompanyList(companyDescriptionPoco.Id);
            PopulateLanguageDropDownList(companyDescriptionPoco.LanguageId);
            return(View(companyDescriptionPoco));
        }
コード例 #27
0
        public ActionResult GetCompanyDescription(Guid id)
        {
            CompanyDescriptionPoco poco = _logic.Get(id);

            if (poco == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(poco));
            }
        }
コード例 #28
0
 public ActionResult Edit([Bind(Include = "Id,Company,LanguageId,CompanyName,CompanyDescription")] CompanyDescriptionPoco companyDescriptionPoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyDescriptionPoco).State = EntityState.Modified;
         companyDescriptionPoco.CompanyProfiles = db.CompanyProfiles.Where(e => e.Id == companyDescriptionPoco.Company).FirstOrDefault();
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Company    = new SelectList(db.CompanyDescriptions, "Company", "CompanyName", companyDescriptionPoco.Company);
     ViewBag.LanguageId = new SelectList(db.SystemLanguageCodes, "LanguageID", "Name", companyDescriptionPoco.LanguageId);
     return(View(companyDescriptionPoco));
 }
コード例 #29
0
        // GET: CompanyDescriptions/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyDescriptionPoco companyDescriptionPoco = db.CompanyDescriptions.Find(id);

            if (companyDescriptionPoco == null)
            {
                return(HttpNotFound());
            }
            return(View(companyDescriptionPoco));
        }
コード例 #30
0
        public async Task <IActionResult> Create([Bind("Id,Company,LanguageId,CompanyName,CompanyDescription")] CompanyDescriptionPoco companyDescriptionPoco)
        {
            if (ModelState.IsValid)
            {
                companyDescriptionPoco.Id = Guid.NewGuid();
                _context.Add(companyDescriptionPoco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Company"]    = new SelectList(_context.CompanyProfiles, "Id", "Id", companyDescriptionPoco.Company);
            ViewData["LanguageId"] = new SelectList(_context.SystemLanguageCodes, "LanguageID", "LanguageID", companyDescriptionPoco.LanguageId);
            return(View(companyDescriptionPoco));
        }