public IHttpActionResult UpdateMetaDataDefination(int id, [FromBody] MetaDataDefinationModel.Format_Update dataModel) { string logForm = "Form : " + JsonConvert.SerializeObject(dataModel); string logAPI = "[Patch] " + Request.RequestUri.ToString(); if (!ModelState.IsValid || dataModel == null) { Global._appLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm); return(Content(HttpStatusCode.BadRequest, HttpResponseFormat.InvaildData())); } try { MetaDataDefinationModel model = new MetaDataDefinationModel(); model.Update(id, dataModel, UserToken.CompanyId); return(Content(HttpStatusCode.OK, HttpResponseFormat.Success())); } catch (CDSException cdsEx) { return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId))); } catch (Exception ex) { StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex); logMessage.AppendLine(logForm); Global._appLogger.Error(logAPI + logMessage); return(Content(HttpStatusCode.InternalServerError, ex)); } }
public IHttpActionResult GetMetaDataDefinationById(int id) { try { MetaDataDefinationModel model = new MetaDataDefinationModel(); return(Content(HttpStatusCode.OK, model.GetById(id, UserToken.CompanyId))); } catch (CDSException cdsEx) { return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId))); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, ex)); } }
public IHttpActionResult DeleteMetaDataDefination(int id) { try { MetaDataDefinationModel model = new MetaDataDefinationModel(); model.DeleteById(id, UserToken.CompanyId); return(Content(HttpStatusCode.OK, HttpResponseFormat.Success())); } catch (CDSException cdsEx) { return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId))); } catch (Exception ex) { string logAPI = "[Delete] " + Request.RequestUri.ToString(); StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex); Global._appLogger.Error(logAPI + logMessage); return(Content(HttpStatusCode.InternalServerError, ex)); } }
public IHttpActionResult GetAllMetaDataDefination() { MetaDataDefinationModel model = new MetaDataDefinationModel(); return(Content(HttpStatusCode.OK, model.GetAllByCompanyId(UserToken.CompanyId))); }