Example #1
0
        public async Task <ActionResult> CreateAssignmentAsync([FromBody] AssignmentDto assignment)
        {
            AssignmentDto createdAssignment = await _assignmentService.CreateAssignmentAsync(assignment);

            return(CreatedAtRoute("GetAssignment",
                                  new { assignmentId = createdAssignment.Id }, createdAssignment));
        }
Example #2
0
        public async Task <IActionResult> CreateAssignmentAsync(Assignment assignment)
        {
            try
            {
                await _assignmentService.CreateAssignmentAsync(assignment);

                return(Ok());
            }
            catch (BussinessException ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, $"Internal server error: {ex.Message}"));
            }
        }