Пример #1
0
        public async Task <IActionResult> DeleteSection(string company, [Range(1, long.MaxValue)] long sectionId)
        {
            var command = new DeleteSectionCommand
            {
                SectionId = sectionId,
                Company   = company
            };

            await _mediator.Send(command);

            return(NoContent());
        }
Пример #2
0
        protected void mod_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("delete"))
            {
                try
                {
                    Section section = new Section();
                    string  id      = ((Label)mod_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    section.Id = Int32.Parse(id);
                    DeleteSectionCommand cmd = new DeleteSectionCommand(section);
                    cmd.Execute();
                    if (section.Code == 200)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertmeErr()", true);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("modify"))
            {
                try
                {
                    string id = ((Label)mod_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    Session["Id_mod"] = id;
                    Response.Redirect("/site/admin/adm_module/edit_mod.aspx");
                }
                catch (Exception ex)
                {
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DeleteSectionCommand cmd = new DeleteSectionCommand(new Section(1, "", 1.0, "", new Course()));

            cmd.Execute();
        }