public async Task <IActionResult> CreateTable([FromForm] CreateTableVM table)
        {
            try
            {
                if (table == null)
                {
                    throw new Exception("table object is missing");
                }
                var menuPage = await _tableService.CreateTableAsync(table);

                return(Ok(menuPage));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #2
0
        public async Task <IActionResult> CreateTable(string tableName)
        {
            if (string.IsNullOrEmpty(tableName))
            {
                return(BadRequest("Geçersiz veri"));
            }

            // Mevcut şubeye ait bir masa tanımlar.
            var table = new Table
            {
                BranchId    = _currentUser.BranchId,
                Code        = _tableService.GenerateTableCode(6),
                DateCreated = DateTime.Now,
                IsClosed    = false,
                Name        = tableName,
            };

            await _tableService.CreateTableAsync(table);

            _logger.LogInformation(string.Format("{0} şubesi {1} isimli bir masa oluşturdu.", _currentUser.Name, table.Name));

            return(Ok("Masa oluşturuldu"));
        }