Ejemplo n.º 1
0
        public ActionResult Add(OfferViewModel offer)
        {
            if (ModelState.IsValid)
            {
                var company = _companiesProvider.GetCompany(offer.Company);
                var type    = _offerTypeProvider.GetOfferType(offer.Type);
                _offerCreator.Create(offer.Title, offer.Description, offer.Trade, company, type);

                return(Json(true));
            }

            return(PartialView("Partials/_FormSubmitResult", ModelState));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetCompany()
        {
            var companyId = GetCompanyClaim();

            if (companyId == null)
            {
                return(BadRequest("No claim"));
            }
            var company = await companiesProvider.GetCompany(companyId);

            if (company != null)
            {
                var companyViewModel = mapper.Map <Company, CompanyViewModel>(company);
                return(Ok(companyViewModel));
            }
            return(NotFound("Company not found"));
        }
Ejemplo n.º 3
0
        public ActionResult Details(int id)
        {
            var c = _companiesProvider.GetCompany(id);

            var companyDetails = new CompanyViewModel()
                {
                    Company = c.Name,
                    Address = string.Format("{0}, {1}, {2}", c.City, c.PostalCode, c.Street),
                    Email = c.Email,
                    Description = c.Description,
                    Id = c.Id,
                    Phone = c.Phone,
                    Site = c.Url
                };

            return View(companyDetails);
        }
Ejemplo n.º 4
0
        public ActionResult ContractUpdate(ContractViewModel contract)
        {
            if (ModelState.IsValid)
            {
                Company company = null;

                if (contract.CompanyId.HasValue)
                {
                    company = _companiesProvider.GetCompany(contract.CompanyId.Value);
                }

                var c = _contractProvider.GetContract(contract.Id);
                c.StartDate = contract.StartDate ?? DateTime.Now;
                c.UniversityRepresentative = contract.UniversityRepresentative;
                c.Company = company;
                c.CompanyRepresentative = contract.CompanyRepresentative;
                c.EndDate = contract.EndDate ?? DateTime.Now;

                _contractUpdater.Update(c);
            }

            return(RedirectToAction("Contract", new { id = contract.Id }));
        }
Ejemplo n.º 5
0
        public JsonResult Details(int id)
        {
            var details = _companiesProvider.GetCompany(id).ToViewModel();

            return(Json(details, JsonRequestBehavior.AllowGet));
        }