public ActionResult DeleteConfirmed(int id) { TypeOfContract typeOfContract = db.TypeOfContracts.Find(id); db.TypeOfContracts.Remove(typeOfContract); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(TypeOfContract typeOfContract) { if (ModelState.IsValid) { db.Entry(typeOfContract).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(typeOfContract)); }
public static SalaryProvider CreateSalaryProvider(TypeOfContract typeOfContract) { var providers = Assembly.GetAssembly(typeof(SalaryProvider)) .GetTypes() .Where(t => typeof(SalaryProvider).IsAssignableFrom(t)); var provider = providers.Single(x => x.Name.ToLowerInvariant().Contains(typeOfContract.ToString().ToLowerInvariant())); return((SalaryProvider)Activator.CreateInstance(provider)); }
public ActionResult Create(TypeOfContract typeOfContract) { if (ModelState.IsValid) { db.TypeOfContracts.Add(typeOfContract); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(typeOfContract)); }
public ContractBuilder TypeOfContract(TypeOfContract contract) { if (SalaryCalculators.TypeOfContract.UmowaZlecenie == contract) { result = new UmowaZlecenie(); } else if (SalaryCalculators.TypeOfContract.UmowaODzielo == contract) { result = new UmowaODzielo(); } return(this); }
// GET: TypeOfContracts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TypeOfContract typeOfContract = db.TypeOfContracts.Find(id); if (typeOfContract == null) { return(HttpNotFound()); } return(View(typeOfContract)); }
static void CreateNewEmployee(string name, string surname, TypeOfContract typeOfContract, int wage) { BaseEmployee employee; var id = ListOfEmployees.Select(e => e.EmployeeId).DefaultIfEmpty(-1).Max() + 1; //if(typeOfContract == TypeOfContract.EmploymentContrat) //{ // employee = new Employee(name, surname, wage, id); //} else //{ // employee = new SpecificEmployee(name, surname, wage,id); //} employee = EmployeeFactory.CreateEmployee(new RequestEmployee() { Name = name, Surname = surname, TypeOfContract = typeOfContract, Wage = wage, EmployeeId = id, }); ListOfEmployees.Add(employee); }