public string PutName(int id, string name) { var item = _context.Items.Find(id); if (item.Name != null || item.Name == null) { item.Name = name; _context.Items.Update(item); _context.SaveChanges(); return("Name has been changed to " + item.Name); } else { return("Error."); } }
public string PutUsername(int id, string username) { var account = _context.CustomerAccount.Find(id); if (account.Username != null) { account.Username = username; _context.CustomerAccount.Update(account); _context.SaveChanges(); return("Username has been changed to " + account.Username); } else { return("Error."); } }
public string PutCurrency(int id, string currency) { var shop = _context.Shops.Find(id); if (shop.Currency != null || shop.Currency == null) { shop.Currency = currency; _context.Shops.Update(shop); _context.SaveChanges(); return("Currency has been changed to " + shop.Currency); } else { return("Error."); } }
public string PutPassword(int id, string password) { var account = _context.BusinessAccount.Find(id); if (account.Password != null) { account.Password = password; _context.BusinessAccount.Update(account); _context.SaveChanges(); return("Password has been changed to " + account.Password); } else { return("Error."); } }
public string PutShipped(int id, DateTime shipping_date) { var status = _context.Orders.Find(id); if (status.Shipped == false) { status.Shipped = true; status.ShippingDate = shipping_date; _context.Orders.Update(status); _context.SaveChanges(); return("Status has been set to shipped " + status.Shipped + " at " + status.ShippingDate); } else { return("This order has already been shipped"); } }