public ActionResult Index(Skill model)
        {
            if (ModelState.IsValid)
            {
                model.Created = DateTime.UtcNow;
                model.Updated = DateTime.UtcNow;
                _searchProvider.AddUpdateEntity(model);

                return(Redirect("Search/Index"));
            }

            return(View("Index", model));
        }
Exemple #2
0
        public IActionResult Post(long id, string name, string description)
        {
            _searchProvider.AddUpdateEntity(
                new Skill
            {
                Created     = DateTimeOffset.UtcNow,
                Description = description,
                Name        = name,
                Id          = id
            });

            string url = $"api/search/{id}/{name}/{description}";

            return(Created(url, id));
        }
        public ActionResult Index(SkillWithListOfDetails model, string createSkillDetailsList)
        {
            if (ModelState.IsValid)
            {
                model.Created = DateTime.UtcNow;
                model.Updated = DateTime.UtcNow;

                model.SkillDetails =
                    JsonConvert.DeserializeObject(createSkillDetailsList, typeof(List <SkillDetail>)) as List <SkillDetail>;

                _searchProvider.AddUpdateEntity(model);
                return(Redirect("Search/Index"));
            }

            return(View("Index", model));
        }