using (DataContext dc = new DataContext()) { eCreditCard ek = new eCreditCard(); var query2 = (from y in dc.eUsers where y.name + " " + y.lname == Session["LoggedUser"].ToString() select y).SingleOrDefault(); var query3 = (from x in dc.eCreditCards where x.UserFK==query2.id select x).SingleOrDefault(); if(query3==null) // so, if there are no credit card for this logged user, it save all required data! { ek.CreditCardNumber = txt_cnumber.Text; ek.SecurityCode = txt_code.Text; ek.ExDate = DateTime.Parse(txt_dateEx.Text); ek.UserFK = query2.id; OrdersController.SaveCard(ek); } else { /*here I have big problem! I want simple thing: if there are credit card for that user, just to update some records (security code, date of expiration..) I have tried like this:*/ ek.CreditCardNumber = txt_cnumber.Text; ek.SecurityCode = txt_code.Text; ek.ExDate = DateTime.Parse(txt_dateEx.Text); ek.UserFK = query2.id; dc.SubmitChanges(); //but don`t work. Doesnt change the record. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)