public async Task <IActionResult> CreateTableBook([FromForm] CreateTableBookVM table) { try { if (table == null) { throw new Exception("table object is missing"); } var menuPage = await _tableService.CreateTableBookAsync(table); return(Ok(menuPage)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <TableBookVM> CreateTableBookAsync(CreateTableBookVM table) { var dbTable = new TableBook { EndTime = table.EndTime, StartTime = table.StartTime, BookTime = table.BookTime, IsConfirm = null, IsActive = table.IsActive, TableId = table.TableId, Comment = table.Comment, ClientId = table.ClientId }; var tableNew = await _db.TableBooks.CreateAsync(dbTable); var ret = new TableBookVM(tableNew); return(ret); }