public ActionResult Details(int id) { IEnumerable <User> userlist = uService.GetCompanyUsers(id); Company com = service.Get(id); ViewBag.CompanyDetails = com; return(View(userlist)); }
public IActionResult Get(int id) { try { var company = _companyServices.Get(id); if (company == null) { return(NotFound()); } return(Ok(company)); } catch (Exception ex) { ModelState.AddModelError("GetCompanyById", ex.Message); return(BadRequest(ModelState)); } }
public IHttpActionResult Get(int id) { if (!_companyServices.IsOwner(id, UserId)) { return(Content(HttpStatusCode.Forbidden, "This is not your company")); } var company = _companyServices.Get(id); return(Ok(new { data = new { company } })); }
public GtMetrics Add(GtMetrics gtMetric) { Company company = _companyServices.Get(gtMetric.CompanyId); if (company == null) { throw new Exception("Error getting company targeted by new metric. Are you sure the comapny Id you posted exists?"); } company.GtMetrics = gtMetric; Company updateCompany = _companyServices.Update(company); //metric = _gtMetricsRepo.Add(gtMetric); if (updateCompany == null) { throw new Exception("Error new adding metric"); } return(gtMetric); }
public IActionResult Get(int id) { return(_main.Get(id) != null ? new JsonResult(new SingleCompanyViewModel(_main.Get(id))) : new JsonResult(new RequestErrorViewModel("Company not found."))); }