public ContentResult GetRequestNumberForCostType(int reportId,int costTypeId) { ContractorAccountDto model; try { model = RequestBl.GetRequestNumberForCostType(reportId,costTypeId); } catch (Exception ex) { Log.Error("Exception on GetRequestNumberForCostType:", ex); string error = ex.GetBaseException().Message; model = new ContractorAccountDto { Error = string.Format("Ошибка: {0}", error) }; } var jsonSerializer = new JavaScriptSerializer(); string jsonString = jsonSerializer.Serialize(model); return Content(jsonString); }
public ContentResult GetContractorAccount(int id) { ContractorAccountDto model; try { model = RequestBl.GetContractorAccount(id); } catch (Exception ex) { Log.Error("Exception on GetContractorAccount:", ex); string error = ex.GetBaseException().Message; model = new ContractorAccountDto { Error = string.Format("Ошибка: {0}", error) }; } JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); var jsonString = jsonSerializer.Serialize(model); return Content(jsonString); }