Ejemplo n.º 1
0
        public async Task <bool> CreateTaskState(NewTaskStateModel newTaskStateModel)
        {
            await loadAuthTask;
            var   content  = JsonSerializer.Serialize(newTaskStateModel);
            var   response = await _httpClient.PostAsync($"api/TaskState", new StringContent(content, Encoding.UTF8, "application/json"));

            return(response.IsSuccessStatusCode);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([FromBody] NewTaskStateModel taskStateModel)
        {
            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            var rowsAffected = await _taskRepository.AddTaskState(taskStateModel, user.ID);

            if (rowsAffected == 0)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <int> AddTaskState(NewTaskStateModel model, int employee)
        {
            int rows;

            using (var cnn = DbConnection)
            {
                var procedure = "[AddTaskState]";
                var values    = new
                {
                    model.Task,
                    model.NewTaskState,
                    DateTime = DateTime.Now,
                    Editor   = employee,
                    model.Note
                };
                rows = await cnn.ExecuteAsync(procedure, values, commandType : CommandType.StoredProcedure);
            }
            return(rows);
        }