update database problem with asp.net mvc 2
Posted
by ognjenb
on Stack Overflow
See other posts from Stack Overflow
or by ognjenb
Published on 2010-05-27T09:05:42Z
Indexed on
2010/05/27
9:11 UTC
Read the original article
Hit count: 174
ASP.NET
|asp.net-mvc
[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
© Stack Overflow or respective owner