Пример #1
0
        public async Task <IActionResult> SaveEntreprise([FromBody] Entreprise item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (item.Id == Guid.Empty)
            {
                item.Id = Guid.NewGuid();
            }
            var result = await _formationService.SaveEntrepriseAsync(item);

            if (result != null)
            {
                result = _formationService.GetEntrepriseForId(item.Id);
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }