Example #1
0
        public IActionResult AddActivity([FromBody] AddActivityBinding obj)
        {
            //if (!HttpContext.Session.IsStudent()) return Unauthorized();


            if (obj.timeSpan == null)
            {
                return(Ok(new { status = "parameter error" }));
            }

            try
            {
                //konvertovanje u timeSpan
                TimeSpans ts = Services.TimeSpan.getTimeSpan(obj.timeSpan);

                studentService.AddActivity(HttpContext.User.GetId(), obj.groupID, obj.classroomID, ts, obj.place, obj.title, obj.content);
                return(Ok(new { status = "success" }));
            }
            catch (Exception ex)
            {
                return(Ok(new { status = "error", message = ex.Message }));
            }
        }