How to use save button in Create Action to make save in both cases insert and update using repository pattern ?
and what changes i will make in view to accept update and insert .
what i writing is when make new record or update record then use save button it will save using create action in employee controller using HTTP post
I use Repository Pattern generics in visual studio 2017 asp.net core 2.1 with sql server 2012
- public class EmployeesController : Controller
- {
- private readonly IEmployees _context;
- public EmployeesController(IEmployees context)
- {
- _context = context;
- }
- [HttpPost]
- public IActionResult Create()
- {
- return View();
- }
create view
- class="form-group">
- ="EmployeeId" class="control-label">
- for="EmployeeId" class="form-control" />
- for="EmployeeId" class="text-danger">
- class="form-group">
- ="BranchCode" class="control-label">
- for="BranchCode" class="form-control" />
- for="BranchCode" class="text-danger">
- class="form-group">
- ="EmployeeName" class="control-label">
- for="EmployeeName" class="form-control" />
- for="EmployeeName" class="text-danger">
- style="display:inline">Save
Bryian TanPosted Jan 6, 2019, 10:20 PM