c# - Adding to a table using MVC 5, and reset Id after deleting records -
i have 2 questions: first wrote code add doctors database, @ beginning code worked fine after adding validation doctor information not added table.. when press add button url goes to: /doctors/save why data not saved in database? , why after pressed add button program not redirect me add view? in controller there add() action add view contains adding form.. save() action html.beginform("save","doctors") inside add view.. here code: public actionresult add() { return view(); } [httppost] [validateantiforgerytoken] public actionresult save(doctor doctor) { if (!modelstate.isvalid) { var viewmodel = new doctorviewmodel { doctor = doctor }; return view("add", viewmodel); } if(doctor.id == 0) { _context.doctors.add(doctor); _context.savechanges(); return redirect("add"); } else ...