예제 #1
0
        public async Task <ViewModel.ServiceResult> PostEditTemplate([FromBody] ViewModel.ContentManager.EditTemplateVM model)
        {
            try
            {
                var res = await ContentManagerRepository.EditTemplate(model.siteid, new Models.Crawl.CrawlTemplate()
                {
                    _id       = model._id,
                    name      = model.name,
                    type      = model.type,
                    sampleurl = model.sampleurl,
                    structure = model.structure
                });

                if (res)
                {
                    return new ViewModel.ServiceResult()
                           {
                               ServiceResultStatus  = (int)Rdio.Util.Common.ServiceResultStatus.OK,
                               ServiceResultMassage = Util.Common.ServiceResultMessage.OKMessage.ToString()
                           }
                }
                ;
                else
                {
                    return new ViewModel.ServiceResult()
                           {
                               ServiceResultStatus  = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                               ServiceResultMassage = Util.Common.ServiceResultMessage.FaildMessage.ToString()
                           }
                };
            }
            catch (Exception ex)
            {
                return(new ViewModel.ServiceResult()
                {
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                    ServiceResultMassage = ex.GetBaseException().Message
                });
            }
        }