Ejemplo n.º 1
0
        public override IHttpActionResult Post(Feature model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var isFeatureExist = _service.IsFeatureExist(model.Name, model.Id, ActionType.Post);

            if (isFeatureExist)
            {
                return(BadRequest(model.Name + " feature already exist."));
            }

            if (string.IsNullOrWhiteSpace(model.Id))
            {
                model.Id = Guid.NewGuid().ToString();
            }
            model.Active = true;

            _service.CreateAsHost(model);

            return(Ok(model.Id));
        }