示例#1
0
        //R-code
        public void AddToUser(string id)
        {
            // Retrieve the product from the database.
            DataContext _db = new DataContext();

            var user = _db.Users.SingleOrDefault(c => c.Id == id);
            if (user == null)
            { // Create a new user if no user exists.
                user = new User {
                    Id = id,
                    FName = Name.Text,
                    LName = "null",
                    DateCreated = DateTime.Now
                };

                _db.Users.Add(user);
            }
            else
            { // If the item does exist in the cart, // then add one to the quantity.
                //user.Quantity++;
            } _db.SaveChanges();
        }
示例#2
0
 public string CheckNullUser(User bidUser)
 {
     if (bidUser == null) return "";
     else return bidUser.FName;
 }