private bool Registration(RegistrationForm form) { const int SUPPLIER_ROLE = 3; var company = dataManager.GetCompanies(bin: form.login).FirstOrDefault(); if (company != null) { var person = new Person() { name = (string.IsNullOrEmpty(form.personName) ? "Пользователь" : form.personName), tel = form.tel }; person.Id = dataManager.CreatePerson(person); if (person.Id > 0) { if (dataManager.CreateUser(person.Id, form.login, form.pass, SUPPLIER_ROLE) > 0) { return(dataManager.AddEmployee(company.id, person.Id, form.position)); } } } return(false); }
public IActionResult Create(Employee newEmployee) { db.AddEmployee(newEmployee); return(View()); }