예제 #1
0
        public IActionResult NewUserCustomeField([FromBody] UserCustomeFieldModel obj)
        {
            var tagsToString = "";

            foreach (var item in obj.FavortieTags)
            {
                tagsToString += item + ",";
            }
            _repository.AddUserCustomeField(obj.userName, obj.postLimit, tagsToString);
            return(Created($"api/customization", "Updated the new Customization"));
        }
        public IActionResult GetUserCustomeField()
        {
            var c = _repository.GetLatestUserCustomeField();

            if (c != null)
            {
                var model = new UserCustomeFieldModel();
                model.postLimit            = c.Postlimit;
                model.FavortieTags         = c.FavoriteTags.Select(x => x.Tag.Tag).ToList();
                model.CreationDate         = c.CreationDate;
                model.MakeNewCustomization = Url.Link(nameof(NewUserCustomeField), new { postlimit = 5, tags = "java,php,laravel" });
                return(Ok(model));
            }
            return(NotFound());
        }