public async Task <TagType> CreateTagTypeAsync(string name, string description, int minCount, int maxCount) { try { var tt = new TagType() { Name = name, Description = description, MinCount = minCount, MaxCount = maxCount }; tt.Initialize(UIDGenerator.Next(1)); await taggerDataContext.TagsRepository.InsertTagTypeAsync(tt); await taggerDataContext.SaveChangesAsync(); return(tt); } catch (Exception ex) { //todo log error throw; } }
public async Task <int> UpdateProductAsync(Product product) { if (!String.IsNullOrEmpty(product.ProductID)) { _dataSource.Entry(product).State = EntityState.Modified; } else { product.ProductID = UIDGenerator.Next(6).ToString(); product.CreatedOn = DateTime.UtcNow; _dataSource.Entry(product).State = EntityState.Added; } product.LastModifiedOn = DateTime.UtcNow; product.SearchTerms = product.BuildSearchTerms(); return(await _dataSource.SaveChangesAsync()); }
public async Task <int> UpdateOrderAsync(Order order) { if (order.OrderID > 0) { _dataSource.Entry(order).State = EntityState.Modified; } else { order.OrderID = UIDGenerator.Next(4); order.OrderDate = DateTime.UtcNow; _dataSource.Entry(order).State = EntityState.Added; } order.LastModifiedOn = DateTime.UtcNow; order.SearchTerms = order.BuildSearchTerms(); return(await _dataSource.SaveChangesAsync()); }
public async Task <int> UpdateOrderAsync(Order order) { if (order.order_id > 0) { _dataSource.Entry(order).State = EntityState.Modified; } else { order.order_id = UIDGenerator.Next(4); order.order_dt = DateTime.UtcNow; order.reg_dt = DateTime.UtcNow; _dataSource.Entry(order).State = EntityState.Added; } order.upd_dt = DateTime.UtcNow; order.searchterms = order.BuildSearchTerms(); return(await _dataSource.SaveChangesAsync()); }
public async Task<int> UpdateCustomerAsync(Customer customer) { if (customer.CustomerID > 0) { _dataSource.Entry(customer).State = EntityState.Modified; } else { customer.CustomerID = UIDGenerator.Next(); customer.CreatedOn = DateTime.UtcNow; _dataSource.Entry(customer).State = EntityState.Added; } customer.LastModifiedOn = DateTime.UtcNow; customer.SearchTerms = customer.BuildSearchTerms(); int res = await _dataSource.SaveChangesAsync(); return res; }
public async Task <int> UpdateCustomerAsync(Customer customer) { if (customer.customer_id > 0) { _dataSource.Entry(customer).State = EntityState.Modified; } else { customer.customer_id = UIDGenerator.Next(); customer.reg_dt = DateTime.UtcNow; _dataSource.Entry(customer).State = EntityState.Added; } customer.upd_dt = DateTime.UtcNow; customer.searchterms = customer.BuildSearchTerms(); int res = await _dataSource.SaveChangesAsync(); return(res); }
public async Task <int> UpdatePlaceAsync(Place place) { if (place.place_id > 0) { _dataSource.Entry(place).State = EntityState.Modified; } else { place.place_id = UIDGenerator.Next(); place.reg_dt = DateTime.UtcNow; _dataSource.Entry(place).State = EntityState.Added; } place.upd_dt = DateTime.UtcNow; place.searchterms = place.BuildSearchTerms(); int res = await _dataSource.SaveChangesAsync(); return(res); }