コード例 #1
0
        public HttpResponseMessage SaveDepartamentos([FromBody] Departamentos Dep)
        {
            bool SuccessfullSaved = DepartamentosHelper.Save(Dep);

            if (!SuccessfullSaved)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
コード例 #2
0
        public HttpResponseMessage GetAllDepartamentos()
        {
            List <Departamentos> list = DepartamentosHelper.GetAll();
            bool TheresData           = list.Count > 0;

            if (!TheresData)
            {
                throw new HttpResponseException(HttpStatusCode.NoContent);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, list));
        }
コード例 #3
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            if (radioActivo.Checked)
            {
                try
                {
                    this.dp             = new Departamentos();
                    this.dp.Descripcion = this.txtdepartamento.Text;
                    this.dp.Estado      = 1;
                    this.dp.Opc         = 1;
                    this.dpH            = new DepartamentosHelper(dp);
                    this.dpH.IngresarDepartamentos();

                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeDeconfirmacion", "mensajeDeconfirmacion('" + "" + "');", true);
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true);
                }
            }
            else if (radioInactivo.Checked)
            {
                try
                {
                    this.dp             = new Departamentos();
                    this.dp.Descripcion = this.txtdepartamento.Text;
                    this.dp.Estado      = 2;
                    this.dp.Opc         = 1;
                    this.dpH            = new DepartamentosHelper(dp);
                    this.dpH.IngresarDepartamentos();

                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeDeconfirmacion", "mensajeDeconfirmacion('" + "" + "');", true);
                }
                catch (Exception)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensajeError", "mensajeError('" + "" + "');", true);
                }
            }
        }