public void Add(Card card)
 {
     using (var db = new BusinessCardScannerEntities())
     {
         db.Configuration.ProxyCreationEnabled = false;
         card.User = null; // Lappeløsning.. ellers blev en ny bruger oprettet hver gang
        // card.EncodedImage = "ÆNDRET I DAL";
         db.Card.Add(card);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new Card object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="cardNumber">Initial value of the CardNumber property.</param>
 /// <param name="zipCode">Initial value of the ZipCode property.</param>
 /// <param name="balance">Initial value of the Balance property.</param>
 /// <param name="expirationDate">Initial value of the ExpirationDate property.</param>
 /// <param name="currencyId">Initial value of the currencyId property.</param>
 /// <param name="cardTypeId">Initial value of the cardTypeId property.</param>
 /// <param name="clientId">Initial value of the clientId property.</param>
 /// <param name="accountTypeId">Initial value of the accountTypeId property.</param>
 public static Card CreateCard(global::System.Int32 id, global::System.String cardNumber, global::System.String zipCode, global::System.Double balance, global::System.DateTime expirationDate, global::System.Int32 currencyId, global::System.Int32 cardTypeId, global::System.Int32 clientId, global::System.Int32 accountTypeId)
 {
     Card card = new Card();
     card.Id = id;
     card.CardNumber = cardNumber;
     card.ZipCode = zipCode;
     card.Balance = balance;
     card.ExpirationDate = expirationDate;
     card.currencyId = currencyId;
     card.cardTypeId = cardTypeId;
     card.clientId = clientId;
     card.accountTypeId = accountTypeId;
     return card;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Cards EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCards(Card card)
 {
     base.AddObject("Cards", card);
 }
 public void Update(Card card)
 {
     using (var db = new BusinessCardScannerEntities())
     {
         db.Configuration.ProxyCreationEnabled = false;
         db.Entry(card).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 /// <summary>
 /// Создание нового объекта Card.
 /// </summary>
 /// <param name="id">Исходное значение свойства Id.</param>
 /// <param name="expirationDate">Исходное значение свойства ExpirationDate.</param>
 /// <param name="number">Исходное значение свойства Number.</param>
 /// <param name="zipCode">Исходное значение свойства ZipCode.</param>
 /// <param name="balance">Исходное значение свойства Balance.</param>
 public static Card CreateCard(global::System.Int32 id, global::System.DateTime expirationDate, global::System.Int64 number, global::System.Int32 zipCode, global::System.Decimal balance)
 {
     Card card = new Card();
     card.Id = id;
     card.ExpirationDate = expirationDate;
     card.Number = number;
     card.ZipCode = zipCode;
     card.Balance = balance;
     return card;
 }