protected void btnSave_Click(object sender, EventArgs e) { try { switch (RowID) { case 0: DocumentTypeService.Add( txtDescription.Text, chkIsLastState.Checked, ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>()); break; default: DocumentTypeService.Update( RowID, txtDescription.Text, chkIsLastState.Checked, ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>()); break; } Refresh(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }
// POST api/<controller> public IHttpActionResult Post([FromBody] ITS_DocumentType supplier) { return(Utils.Response(MapService.MapOne <ITS_DocumentType, DocumentTypeDTO>(Service.Add(supplier)), HttpStatusCode.InternalServerError, string.Format("Could not create document type {0}.", supplier.DocumentType), Request.RequestUri.AbsoluteUri)); }