public TableModel Add(TableModel model) { var entity = _mapper.Map <Table>(model); _tableRepository.Add(entity); _tableRepository.Save(); return(model); }
public async Task <string> Add(CloudTable responseMetasTable, HttpResponseMessage response) { var responseMeta = new ResponseMeta(response, DateTimeOffset.UtcNow); logger.LogDebug($"Adding new response meta:\n{responseMeta}"); await tableRepository.Add(responseMetasTable, responseMeta); return(responseMeta.RowKey); }
public void AddTransactionInfo(TransactionInfo args) { var transactionInfo = new TransactionHistory() { CustomerOrderID = args.CustomerOrderId, SalerOrderID = args.SalerOrderId, TransactionDateTime = args.TrDateTime }; tableRepository.Add(transactionInfo); tableRepository.SaveChanges(); }
public void Table_Repository_Create() { Table table = new Table(); table.ID = 1; table.Name = "Table 1"; table.Status = true; table.UpdataBy = "Henry"; var result = objecRepository.Add(table); Assert.AreEqual(1, result.ID); Assert.IsNotNull(result); }
public IActionResult Create([FromBody] Table item) { if (item == null) { return(BadRequest()); } item.CurrentShoe = new Shoe(item.DecksInShoe); _tableRepository.Add(item); return(CreatedAtRoute("GetTable", new { id = item.Key }, item)); }
public void TestCRUD_Create() { ITableRepository <TTableType> repository = DataSource.DataRepository.GetTableRepositoryFor <TTableType>(TableName); Assert.AreEqual(TableName, repository.Name); TTableType data = repository.Add(NewDomainTableData()); data.Should().NotBeNull(); TableID = data.Id; TableID.Should().BeGreaterThan(0); }
public void TestCRUD_AllItems() { ITableRepository <TTableType> repository = DataSource.DataRepository.GetTableRepositoryFor <TTableType>(TableName); Assert.AreEqual(TableName, repository.Name); repository.Add(NewDomainTableData()); var items = repository.Items(); items.Should().NotBeNull(); items.Count.Should().BeGreaterThan(0); }
public void AddOrder(OrderInfo args) { Order order = new Order { ClientID = args.ClientId, StockID = args.StockId, Quantity = args.Quantity, OrderType = (OrderType)args.OrderType, IsExecuted = false } ; tableRepository.Add(order); tableRepository.SaveChanges(); }
public void AddIssuer(IssuerInfo args) { Issuer issuer = new Issuer() { CompanyName = args.CompanyName, Address = args.Address }; if (this.tableRepository.ContainsDTO(issuer)) { throw new ArgumentException("This issuer exists. Can't continue"); } ; tableRepository.Add(issuer); tableRepository.SaveChanges(); }
public void AddStock(StockInfo args) { var stockToAdd = new Stock() { StockPrefix = args.StockPrefix, IssuerID = args.IssuerId, StockType = (StockType)args.ShareType }; if (this.tableRepository.ContainsDTO(stockToAdd)) { throw new ArgumentException("This stock exists. Can't continue"); } ; tableRepository.Add(stockToAdd); tableRepository.SaveChanges(); }
public void AddPriceInfo(PriceInfo args) { PriceHistory priceHistory = new PriceHistory() { StockID = args.StockId, DateTimeBegin = args.DateTimeBegin, DateTimeEnd = args.DateTimeEnd, Price = args.Price }; if (this.tableRepository.ContainsDTO(priceHistory)) { throw new ArgumentException("This price history exists. Can't continue"); } ; tableRepository.Add(priceHistory); tableRepository.SaveChanges(); }
public IResult Save(TableDto tableDto) { TableEntity table = new TableEntity(tableDto.Number); if (_tableRepository.Get(table) != null) { return(new ValidateResult(table, false, "Mesa informada já existe")); } table.Validate(); if (table.Invalid) { return(new ValidateResult(table.Notifications, false, "Problemas ao cadastrar a Mesa")); } _tableRepository.Add(table); return(new ValidateResult(table, true, "Mesa cadastrada com sucessso")); }
public Table CreateTable(CreateTableRequest request) { if (request.Number <= 0) { throw new InvalidRequestException("Table number cannot be 0 or a negative number."); } if (request.PartySize <= 0) { throw new InvalidRequestException("Table's supported PartySize must be bigger than 0."); } ValidateTableNumberUnique(request.Number); var table = new Table(request); _tableRepository.Add(table); SaveChanges(); return(table); }
public ActionMessage Add(string tableName) { ActionMessage response = new ActionMessage(); Table table = tableRepository.GetByName(tableName); if (table == null) { Table newTable = new Table(); newTable.TableName = tableName; newTable.IsAvailable = true; tableRepository.Add(newTable); response.Message = "Table succesfuly created"; } else { response.Error = $"Table {tableName} already exists"; } return(response); }
public Table Add(Table table) { return(_tableRepository.Add(table)); }