Esempio n. 1
0
        public async Task <IActionResult> DeleteFunctionAsync([FromRoute] int functionId)
        {
            var function = await _functionRepository.GetFunctionByIdAsync(functionId);

            if (function == null)
            {
                throw new NotFound404Exception("function");
            }

            if (function.Code.Contains("Full"))
            {
                throw new ForbiddenException(); // can not delete 'Full' functions
            }

            function.IsDeleted   = true;
            function.UpdatedDate = DateTime.Now;
            function.UpdatedBy   = CurrentAccountId;

            await _functionRepository.UpdateFunctionAsync(function);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
 public async Task <IActionResult> Put([Required] string id, [FromBody] Function function)
 {
     return(Ok(await _functionRepository.UpdateFunctionAsync(id, function)));
 }