Exemple #1
0
        public HttpResponseMessage AddModuleSearch(HttpRequestMessage request, MdSearchViewModel mdSearchVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                try
                {
                    MdSearch mdSearchDb = new MdSearch();
                    mdSearchDb.BotID = mdSearchVm.BotID;
                    mdSearchDb.Title = mdSearchVm.Title;
                    mdSearchDb.Payload = mdSearchVm.Payload;
                    mdSearchDb.CardPayloadID = mdSearchVm.CardPayloadID;
                    mdSearchDb.UrlAPI = mdSearchVm.UrlAPI;
                    mdSearchDb.TitlePayload = mdSearchVm.TitlePayload;
                    mdSearchDb.MethodeAPI = mdSearchVm.MethodeAPI;
                    if (!String.IsNullOrEmpty(mdSearchVm.KeyCodeAPI) && !String.IsNullOrEmpty(mdSearchVm.KeyNameAPI))
                    {
                        mdSearchDb.KeyAPI = mdSearchVm.KeyNameAPI + ":" + mdSearchVm.KeyCodeAPI;
                    }

                    mdSearchDb.ParamAPI = mdSearchVm.ParamAPI;
                    mdSearchDb.MessageStart = mdSearchVm.MessageStart;
                    mdSearchDb.MessageError = mdSearchVm.MessageError;
                    mdSearchDb.MessageEnd = mdSearchDb.MessageEnd;
                    mdSearchDb.ID = mdSearchVm.ID;
                    mdSearchDb.MdSearchCategoryID = mdSearchVm.MdSearchCategoryID;
                    _mdSearchService.Create(mdSearchDb);
                    _mdSearchService.Save();
                    response = request.CreateResponse(HttpStatusCode.OK, mdSearchDb);
                }
                catch (Exception ex)
                {
                    response = request.CreateResponse(HttpStatusCode.BadGateway);
                }
                return response;
            }));
        }
 public void Update(MdSearch module)
 {
     _mdSearchRepository.Update(module);
 }
 public MdSearch Create(MdSearch module)
 {
     return(_mdSearchRepository.Add(module));
 }