public IHttpActionResult Delete(Categorias categoria) { try { var mng = new CategoriasManager(); mng.Delete(categoria); apiResp = new ApiResponse(); apiResp.Message = "Action was executed."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public void SeleccionoBarra() { this.textoBoxp2.Focus(); if (comandBar1.Status == RecordAction.Search) { Carga_Busqueda(); } if (comandBar1.Status == RecordAction.None) { this.panel1.Enabled = false; } if (comandBar1.Status == RecordAction.Insert || (comandBar1.Status == RecordAction.Update)) { this.panel1.Enabled = true; this.panel1.Select(); if (comandBar1.Status == RecordAction.Insert) { initField(); } textoBoxp2.Focus(); } if (comandBar1.Status == RecordAction.Delete && comandBar1.confirma) { catManager.Delete(currentCat.Idcategoria); this.comandBar1.confirma = false; initField(); panel1.Enabled = false; Utilities.Mensaje(errorBar1, "El registro fue Borrado", errorType.Error); } if (comandBar1.Status == RecordAction.Save) { var aux = validaforma(); if (aux != "") { errorBar1.Mensaje = aux; errorBar1.Status = errorType.Error; this.comandBar1.Novalido(); return; } if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Insert && aux == "") { var Cat = new Categoria { Pesa = checkBox2.Checked, Activo = checkBox1.Checked, CategoriaDesc = textoBoxp2.Text, Idcategoria = 0 }; var aux1 = validarRegistro(Cat); if (aux1.Length > 0) { Utilities.Mensaje(errorBar1, aux1, errorType.Error); return; } catManager.InsertCategorias(Cat); this.comandBar1.previo = RecordAction.None; Utilities.Controles(this, "Reset"); panel1.Enabled = false; } if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Update && aux == "") { var Cat = new Categoria { Pesa = checkBox2.Checked, Activo = checkBox1.Checked, CategoriaDesc = textoBoxp2.Text, Idcategoria = Convert.ToInt16(labelindex.Text) }; var Catdto = new CategoriaDTO { pesa = checkBox2.Checked, activo = checkBox1.Checked, CategoriaDesc = textoBoxp2.Text, Idcategoria = Convert.ToInt16(labelindex.Text) }; var aux1 = validarRegistro(Cat); if (aux1.Length > 0) { Utilities.Mensaje(errorBar1, aux1, errorType.Error); return; } catManager.Edit(Catdto); this.comandBar1.previo = RecordAction.None; Utilities.Controles(this, "Reset"); panel1.Enabled = false; } } }