public static void SetPassword(collectorEntities1 DB, string password) { var user = DB.Users.OrderByDescending(u => u.ID).FirstOrDefault(); password = Utils.sha256(password + user.ID); user.Password = password; DB.SaveChanges(); }
public static void PostItem(collectorEntities1 DB, dynamic jsonItem) { CollectionItem item = new CollectionItem(); item.ItemName = jsonItem.itemName; item.UPC = jsonItem.upcCode; item.UserID = jsonItem.userID; DB.CollectionItems.Add(item); DB.SaveChanges(); }
public static void CreateUser(collectorEntities1 DB, string username, string password, string displayName) { User user = new User() { Username = username, DisplayName = displayName }; DB.Users.Add(user); DB.SaveChanges(); SetPassword(DB, password); }
public static void PostBarcodeItem(collectorEntities1 DB, dynamic jsonItem) // Needs checked because barcodes add a 13 char { BarcodeItem item = new BarcodeItem() { Upc = jsonItem.upc, Ean = jsonItem.ean, Category = jsonItem.category, Brand = jsonItem.brand, Model = jsonItem.model, Manufacturer = jsonItem.manufacturer, Description = jsonItem.description, Title = jsonItem.title }; DB.BarcodeItems.Add(item); DB.SaveChanges(); }