Exemplo n.º 1
0
        public int GetLookupIDOrCreate(LookupsCategories lookupsCategory, string nationality)
        {
            vw_KeyValue nat_lookup = GetLookup(lookupsCategory).Where(lookup => lookup.Name.Equals(nationality)).FirstOrDefault();

            if (nat_lookup == null)
            {
                nat_lookup = LookupRepository.Create(lookupsCategory, nationality);
            }


            return(nat_lookup.ID);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PostAsync([FromBody] Lookup value)
        {
            try
            {
                var dbValue = await LookupRepository.Create(value);

                return(Ok(dbValue));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.ToString()));
            }
        }