Exemplo n.º 1
0
        public async Task <OperationResult> AddNewEvent(AddNewEventDTO dto)
        {
            var result = await _httpClient.PostAsJsonAsync("attendance/event", dto);

            if (result.IsSuccessStatusCode)
            {
                return(new OperationResult(true));
            }

            return(new OperationResult(await result.Content.ReadAsStringAsync()));
        }
        public async Task <IActionResult> AddNewEvent(AddNewEventDTO dto)
        {
            var attendanceProject = await _dbContext.AttendanceProjects.FindAsync(dto.ProjectId);

            attendanceProject.Events.Add(new Event
            {
                Name  = dto.EventName,
                Start = dto.Start,
                End   = dto.End
            });
            await _dbContext.SaveChangesAsync();

            return(Ok());
        }