Ejemplo n.º 1
0
        public async Task <ActionResult> PutAsync(int id, [FromForm] string othername)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            if (othername.Length < 1)
            {
                try
                {
                    return(await GetAllSomethingElseIncludeSomethingAsync());
                }
                catch (Exception ex)
                {
                    logger.LogError(ex, "An error occurred");
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }

            if (id < 1)
            {
                try
                {
                    return(await GetAllSomethingElseIncludeSomethingAsync());
                }
                catch (Exception ex)
                {
                    logger.LogError(ex, "An error occurred");
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }
            try
            {
                await updateInteractor.UpdateSomethingElseAddSomethingAsync(id, othername);

                return(await GetAllSomethingElseIncludeSomethingAsync());
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "An error occurred");
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> PutAsync(int id, [FromForm] string othername)
        {
            if (id < 1)
            {
                return(await GetAllSomethingElseIncludeSomethingAsync());
            }

            await updateInteractor.UpdateSomethingElseAddSomethingAsync(id, othername);

            return(await GetAllSomethingElseIncludeSomethingAsync());
        }