public Answer Controllers() { if (string.IsNullOrEmpty(Name) || string.IsNullOrWhiteSpace(Name)) { return(Answer.Error("Name can not be null, Empty or white space.")); } if (string.IsNullOrEmpty(Adress) || string.IsNullOrWhiteSpace(Adress)) { return(Answer.Error("Adress can not be null, Empty or white space.")); } if (Popularity >= 6 || Popularity <= -1) { return(Answer.Error("Popularity can not be under 0 or higher than 5(0-5)")); } if (Img.Length > 256000) { return(Answer.Error("Img size can not be bigger then 256 kilobytes.(256 000 bytes)")); } if (Id_City >= -1) { return(Answer.Error("Id_City can to be or be under -1.")); } return(Answer.Complete()); }
public static Answer Order_To_Drink(int idOrder, int idDrink) { try { Order_To_Drink to = new Order_To_Drink(); to.Id_Drink = idDrink; to.Id_Order = idOrder; db.Order_To_Drink.Add(to); db.SaveChanges(); return(Answer.Complete("Allt är bra")); } catch (Exception ex) { return(Answer.Error(ex.Message)); } }
public static Answer Ingredient_To_Food(int idFood, int idIngredient) { try { Ingredient_To_Food to = new Ingredient_To_Food(); to.Id_Food = idFood; to.Id_Ingredient = idIngredient; db.Ingredient_To_Food.Add(to); db.SaveChanges(); return(Answer.Complete("Allt är bra")); } catch (Exception ex) { return(Answer.Error(ex.Message)); } }
public static Answer Order_To_Food(int idOrder, int idFood) { try { Order_To_Food to = new Order_To_Food(); to.Id_Food = idFood; to.Id_Order = idOrder; db.Order_To_Food.Add(to); db.SaveChanges(); return(Answer.Complete("Allt är bra")); } catch (Exception ex) { return(Answer.Error(ex.Message)); } }