예제 #1
0
        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));
            }
        }
예제 #2
0
 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));
     }
 }
예제 #3
0
 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));
     }
 }
예제 #4
0
        public IHttpActionResult GetAllMetaDataDefination()
        {
            MetaDataDefinationModel model = new MetaDataDefinationModel();

            return(Content(HttpStatusCode.OK, model.GetAllByCompanyId(UserToken.CompanyId)));
        }