public IActionResult Create(Payroll collection) { ProzivContext DB = new ProzivContext(); ViewData["IdEmployee"] = new SelectList(_context.Employees, "IdEmployees", "IdEmployees", collection.IdEmployee); ViewData["Month"] = new SelectList(_context.Month, "IdMonth", "IdMonth", collection.Month); ViewData["Years"] = new SelectList(_context.Years, "IdYears", "IdYears", collection.Years); string connectionString = @"Data Source=DESKTOP-1BOJ113\ACER;Initial Catalog=Proziv;Integrated Security=True"; string sqlExpression = "SP_Payroll"; using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString)) { connection.Open(); System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(sqlExpression, connection); command.CommandType = System.Data.CommandType.StoredProcedure; System.Data.SqlClient.SqlParameter empParameter = new System.Data.SqlClient.SqlParameter { ParameterName = "@EmployeeID", Value = collection.IdEmployee }; command.Parameters.Add(empParameter); System.Data.SqlClient.SqlParameter yearParameter = new System.Data.SqlClient.SqlParameter { ParameterName = "@year", Value = collection.Years }; command.Parameters.Add(yearParameter); System.Data.SqlClient.SqlParameter monthParameter = new System.Data.SqlClient.SqlParameter { ParameterName = "@month", Value = collection.Month }; command.Parameters.Add(monthParameter); System.Data.SqlClient.SqlParameter salaryParametr = new System.Data.SqlClient.SqlParameter { ParameterName = "@salary", Value = collection.SumSalary }; command.Parameters.Add(salaryParametr); var result = command.ExecuteNonQuery(); // return NotFound("Не достаточно суммы бюджета для выдачи зарплаты"); } List <Payroll> list = DB.Payroll.ToList(); Payroll payroll = list.Last(); return(RedirectToAction(nameof(Index))); }
public CreditsController(ProzivContext context) { creditsrepo = new Creditsrepository(); }
public FinishedProductsController(ProzivContext context) { finishedProductsrepo = new FinProductrepository(); unitsrepo = new UnitOfMeasurerepository(); }
public PayrollsController(ProzivContext context) { _context = context; }