public IActionResult AddSection(CreateSectionCommand command)
        {
            command.TeacherID = UserID;
            var response = Mediator.Send(command);

            return(Json(response));
        }
Beispiel #2
0
        public async Task <IActionResult> CreateSection(CreateSectionCommand command)
        {
            if (await Mediator.Send(command) == null)
            {
                return(BadRequest());
            }

            var request = await Mediator.Send(new GetSectionDetailQuery { Id = command.Id });

            if (request != null)
            {
                return(Json(new
                {
                    headlineId = command.HeadlineId,
                    view = await this.RenderViewAsync("_Section", request, true)
                }));
            }

            return(BadRequest());
        }
Beispiel #3
0
        protected void Reg_Mod(object sender, EventArgs e)
        {
            course              = new Course();
            course.Id           = list_course.SelectedValue;
            course.Name         = list_course.DataTextField;
            section             = new Section();
            section.Name        = name.Value;
            section.Description = desc.Value;
            section.Amount      = Double.Parse(amount.Value);
            section.Course      = course;
            CreateSectionCommand cmd = new CreateSectionCommand(section);

            cmd.Execute();
            if (section.Code == 200)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_succ()", true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
            }
        }
Beispiel #4
0
        public async Task <IActionResult> Create([FromBody] CreateSectionCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }