예제 #1
0
        public IActionResult AddToGroup(int studentID, int groupID)
        {
            // if (!HttpContext.Session.IsAssistant()) return Unauthorized();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                studentService.AddToGroup(studentID, groupID);
            }
            catch (InconsistentDivisionException ex)
            {
                return(Ok(new { status = "inconsistent division", message = ex.Message }));
            }
            catch (Exception ex)
            {
                return(Ok(new { status = "nije uspelo", message = ex.Message }));
            }

            return(Ok(new { status = "uspelo" }));
        }