public async Task <ActionResult> CreateAsync([FromForm] string name)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     if (name == null)
     {
         return(BadRequest());
     }
     if (name.Length < 1)
     {
         try
         {
             return(await GetAllAsync());
         }
         catch (Exception ex)
         {
             logger.LogError(ex, "An error occurred");
             return(StatusCode(StatusCodes.Status500InternalServerError));
         }
     }
     try
     {
         createInteractor.CreateSomething(name);
         return(await GetAllAsync());
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "An error occurred");
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
        public ActionResult Create([FromForm] string name)
        {
            if (name.Length < 1)
            {
                return(GetAll());
            }

            createInteractor.CreateSomething(name);
            return(GetAll());
        }
Exemple #3
0
        public async Task <ActionResult> CreateAsync([FromForm] string name)
        {
            if (name.Length < 1)
            {
                return(await GetAllAsync());
            }

            createInteractor.CreateSomething(name);
            return(await GetAllAsync());
        }