コード例 #1
0
        public override IHttpActionResult Post(Edition model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bool isEditionExist = _service.IsEditionExist(model.Name, model.Id);

            if (isEditionExist)
            {
                return(BadRequest(model.Name + " edition already exist"));
            }

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

            Service.CreateAsHost(model);

            return(Ok(model.Id));
        }