update database problem with asp.net mvc 2
- by ognjenb
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Numbers(int id, int val, int name)
{
int temp = val % 2;
brojevi br = new brojevi();
if (temp == 1 && name == 1) {
var nmb = (from n in numbers.brojevi
where n.prvi_br == id
select n).First();
br.prvi_br = nmb.prvi_br - 1;
numbers.SaveChanges();
}
var nm = from n in numbers.brojevi
select n;
return View(nm);
}
Data table brojevi have 3 fields but I have to change(update) only one of them (prvi_br). Why my solutions doesn't save changes to database