예제 #1
0
        public PartialViewResult OperationsByEmployee(int id)
        {
            List <Operation> operations = _employeeRepository.GetOperationsById(id);

            if (operations == null || operations.Count == 0)
            {
                operations.Add(new Operation()
                {
                    Name = "Операции отсутствуют"
                });
            }
            ;

            return(PartialView(operations));
        }
예제 #2
0
        private string ListOperationsToJson(int userId)
        {
            List <Operation> operations = _employeeRepository.GetOperationsById(userId);

            StringBuilder sb = new StringBuilder();

            sb.Append("[");
            foreach (Operation operation in operations)
            {
                sb.Append("{\"id\":\"");
                sb.Append(operation.Id);
                sb.Append("\",\"count\":\"");
                sb.Append(operation.CountEmployees);
                sb.Append("\"},");
            }
            ;
            sb.Replace(',', ']', sb.Length - 1, 1);

            return(sb.ToString());
        }