I am creating a simple inventory system in Asp.net MVC
I have got an error at this line below
int db_product = db.products.First(e => e.id == m.barcode_id);
As the comments noted, the error really says it all. One of your variables is an int and one is a string so they cannot be directly compared. You need to convert either the int to a string or the string to an int, I would do the latter in this case but both can work. Something like this could work:
var db_product = db.products.First(e => e.id.ToString() == m.barcode_id)
db_product.qty = db_product.qty - m.qty; on the next line? The first line find the product you need and the next calculates the new qty value.int db_product but the thing you are getting is not an int, it is a product from your products table. Change the int db_product to be var db_product as I just did in my edit, then add the second line where you do the subtraction.
int.Parse(m.barcode_id)but it depends on what you expect the ID to be. It would always have to be a number for that to work. This might not be compatible with your database context if you're using entity framework for example.