Beispiel #1
0
        public string Delete(int id)
        {
            Institution Institution = new Institution();

            try
            {
                Institution.GetById(id);
                if (Institution == null)
                {
                    Error  error      = new Error("Nao encontrado");
                    string jsonString = JsonSerializer.Serialize(error);

                    return(jsonString);
                }
                Institution.Id = id;
                Institution.Delete();

                return("Deletado com Sucesso");
            }
            catch (Exception ex)
            {
                Error  error      = new Error(ex.ToString());
                string jsonString = JsonSerializer.Serialize(error);

                return(jsonString);
            }
        }
        protected void DeleteInstitution(object sender, CommandEventArgs e)
        {
            int         key = int.Parse(e.CommandArgument.ToString());
            Institution biz = new Institution();

            biz.Delete(key);
            InstitutionGrid.DataBind();
        }