Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] Menus inputModel)
        {
            try
            {
                var exist = await _menuManager.Find_By_Name(inputModel.Name);

                if (exist != null)
                {
                    throw new Exception($"Tên Menu {MessageConst.EXIST}");
                }

                inputModel.CreatedDate = DateTime.Now;

                await _menuManager.Create(inputModel);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }