Beispiel #1
0
        public HttpResponseMessage GetEntiMappings(string id)
        {
            EntiMappings model = new EntiMappings();
            int          idMap = -1;

            if (!int.TryParse(id, out idMap))
            {
                model = new api.EntiMappings();
            }
            else
            {
                model = (EntiMappings)s.FindByIdMap(idMap);
            }
            return(this.Request.CreateResponse <EntiMappings>(HttpStatusCode.OK, model));
        }
Beispiel #2
0
        public HttpResponseMessage PutMapping(EntiMappings mapping)
        {
            Response <EntiMappings> response = new Response <EntiMappings>();

            try
            {
                ContactsBackendMap bMap = (ContactsBackendMap)mapping;
                s.UpdateMapping(bMap);
                List <EntiMappings> list = new List <EntiMappings>();
                list.Add(mapping);
                response.Totale  = 1;
                response.Message = "Operazione effettuata";
                response.Data    = list;
            }
            catch
            {
                response.Totale  = 0;
                response.Message = "Errore nell'aggiornamento del contatto";
            }
            return(this.Request.CreateResponse <Response <EntiMappings> >(HttpStatusCode.OK, response));
        }
Beispiel #3
0
        public HttpResponseMessage CreateMapping(EntiMappings mapping)
        {
            Response <EntiMappings> resp = new Response <EntiMappings>();

            try
            {
                ContactsBackendMap bMap = (ContactsBackendMap)mapping;
                s.CreateMapping(bMap);
                mapping.EnteMapping.ElementAt(0).Mapping.ElementAt(0).Id = bMap.Id;
                List <EntiMappings> list = new List <EntiMappings>();
                list.Add(mapping);
                resp.Totale  = 1;
                resp.Message = "Operazione effettuata";
                resp.Data    = list;
            }
            catch
            {
                resp.Totale  = 0;
                resp.Message = "Errore nell'inserimento del contatto";
            }
            return(this.Request.CreateResponse <Response <EntiMappings> >(HttpStatusCode.OK, resp));
        }