public bool create(Drink_type drink_Type) { try { drink_Type.created_at = DateTime.Now; drink_Type.updated_at = DateTime.Now; db.Drink_type.Add(drink_Type); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool update(Drink_type drink_Type, int id) { try { drink_Type.updated_at = DateTime.Now; (from drink in db.Drink_type where drink.id_type == id select drink) .ToList() .ForEach((p) => { p.name = drink_Type.name; }); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }