Exemple #1
0
        // POST: api/Projects
        public GenericResponse <string> PostProject(ProjectModel project)
        {
            //TODO: THIS VALIDATION CAN BE EXTRACTED INTO A VALIDATION METHOD FOR REUSABILITY
            if (!ModelState.IsValid)
            {
                return(new GenericResponse <string>
                {
                    StatusCode = 400,
                    Message = "BAD REQUEST"
                });
            }

            if (_service.AddProject(project) == 1)
            {
                _signalRClientMethodsHelper.RefreshProjectsList();
                return(new GenericResponse <string>
                {
                    StatusCode = 200,
                    Message = "NO CONTENT"
                });
            }

            return(new GenericResponse <string>
            {
                StatusCode = 500,
                Message = "SERVER ERROR"
            });
        }
        private AlexaResponse AddEmployeeToProject(Request request)
        {
            var projectName  = request.SlotsList.FirstOrDefault(s => s.Key == "projectName").Value;
            var employeeName = request.SlotsList.FirstOrDefault(s => s.Key == "employeeName").Value;

            var output = _projectService.AddEmployeeToProjectByName(employeeName, projectName);

            _signalRClientMethodsHelper.RefreshProjectsList();

            return(new AlexaResponse(output, false));
        }