'Asp.net core MVC (C#, Sql and EF core)

I am new to this field, please help me on the below query.

I am creating a stock management website which has an admin panel where we can create Categories, Sub Categories and Products. Now I need a Purchase and Sell Module along with a Stock Module. What I want is When I purchase a product i want my stock to be incremented and decremented while selling the same.

I have reached a point where I am stuck on Purchase module which consists of Purchase ID , Category ID , Main Category ID , Product ID, Quantity , Cost Price. I have just purchased 5 quantity of a book. How do I now save that to stock module , please help me what I want to do further



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source