public HttpResponseMessage GetMachineViewModel(FilterViewModel filters) { if (filters.machine != null) { var isCorrect = _contextService.CheckSecurityParameterApi(filters.machine.id, enCheckParam.Machine); if (!isCorrect) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } _contextService.SetActualMachine(filters.machine.id); } if (filters.period != null) { _contextService.SetActualPeriod(filters.period.start, filters.period.end); } _contextService.CheckLastUpdate(); var context = _contextService.GetContext(); var machine = _machineViewService.GetMachine(context); return(Request.CreateResponse(HttpStatusCode.OK, machine, MediaTypeHeaderValue.Parse("application/json"))); }
public ActionResult Index() { try { if (!_contextService.InitializeMachineLevel()) { return(RedirectToAction("Logout", "Account", new { returnUrl = string.Empty, exception = 4 })); } _contextService.SetActualLanguage(CultureInfo.CurrentCulture.Name); var context = _contextService.GetContext(); var machine = _machineViewService.GetMachine(context); return(View(machine)); } catch (Exception ex) { Debugger.Break(); throw ex; } }