Exemplo n.º 1
0
        private void CreateHeroeHashtag(List <string> list, ref HeroeVO createdItem)
        {
            HeroeHashtag h = new HeroeHashtag {
                idObjectA = createdItem.Id ?? default(long)
            };

            var errou = false;

            foreach (string s in list)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }

                HashtagVO vo = new HashtagVO {
                    Name = s.ToLower()
                };
                try
                {
                    var ret = _hashtag.FindOrCreate(vo);
                    h.idObjectB = ret.Id ?? default(long);
                    _heroeHashtag.Create(h);
                }
                catch
                {
                    if (!errou)
                    {
                        _logger.Information("> " + createdItem.Name + " - Hashtag");
                        errou = true;
                    }
                    _logger.Error(s);
                }
            }
        }
 public IActionResult Post([FromBody] HeroeHashtag item)
 {
     if (item == null)
     {
         return(BadRequest());
     }
     return(new  ObjectResult(_business.Create(item)));
 }
 public HeroeHashtag Create(HeroeHashtag mccHeroeHashtag)
 {
     return(_repository.Create(mccHeroeHashtag));
 }