public static bool add(CarEngine.Part type, int status, int amount) { bool success = false; string key = PartData.getKey(type, status); PartData part = PartData.getOne(x => x.key == key); if (part != null) { part.quantity += amount; part.save(); success = true; } else { PartData item = new PartData { part = (int)type, quantity = amount, status = status }; success = item.create (); } return success; }
public static bool add(CarEngine.Part type, int status, int amount) { bool success = false; string key = PartData.getKey(type, status); PartData part = PartData.getOne(x => x.key == key); if (part != null) { part.quantity += amount; part.save(); success = true; } else { PartData item = new PartData { part = (int)type, quantity = amount, status = status }; success = item.create(); } return(success); }