public void ChangePassword(string uName, string newPassword) { using (cnViragkereskedes context = new cnViragkereskedes()) { var oldPassword = context.enUsers.SingleOrDefault(x => x.user_name == uName); oldPassword.user_password = newPassword; oldPassword.user_name = uName; context.Entry(oldPassword).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public bool ModifyProduct(List <ProductsList> CProd) { using (cnViragkereskedes context = new cnViragkereskedes()) { var ProductToChange = new enProduct(); foreach (var prod in CProd) { ProductToChange = context.enProducts.Where(x => x.product_name == prod.Name).First(); ProductToChange.product_name = prod.Name; ProductToChange.product_price_net = prod.NetPrice; ProductToChange.product_fees = prod.Fees; ProductToChange.product_sale = prod.Sale; ProductToChange.product_description = prod.Description; ProductToChange.product_icon = prod.Icon; ProductToChange.product_active = prod.Active; ProductToChange.product_price_gross = prod.GrossPrice; } context.Entry(ProductToChange).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(true); } }