public void SaveEmployeeDetail(int id, EmployeeModel model) { //var EmployeeStore = _service.GetEmployeeStoreById(id, model.StoreId); //var test = 0; //if (Equals(EmployeeStore, null)) //{ // test = 1; //} using (TransactionScope scope = new TransactionScope()) { var EmployeeStore = _service.GetEmployeeStoreById(id, model.StoreId); var EmployeeProfile = _service.GetUserProfileById(id); var Employee = _service.GetUserById(id); if (Equals(Employee, null)) { ExceptionContent(HttpStatusCode.InternalServerError, "employee_or_store_not_exist"); } if (Equals(EmployeeStore, null)) { EmployeeStore = new employee_store() { employee_id = id, employee_store_id = 0 }; } EmployeeStore.store_id = model.StoreId; _service.SaveEmployeeStore(EmployeeStore); EmployeeProfile.full_name = model.FullName; EmployeeProfile.address = model.Address; EmployeeProfile.birthday = model.Birthday; EmployeeProfile.email = model.Email; EmployeeProfile.gender = model.Gender; EmployeeProfile.role = model.Role; Employee.email = model.Email; Employee.role = model.Role; _service.SaveUserProfile(EmployeeProfile); _service.SaveUser(Employee); scope.Complete(); } //return test; }
public void SaveEmployeeStore(employee_store model) { EmployeeStoreRepository.Save(model); }