예제 #1
0
        public void EmployeeSet(EmployeeVM vm, ref IMDResponse res)
        {
            var user = UserAccountSet(vm.UserAccountVM, ref res);

            if (!res.HasNoErrors || user == null)
            {
                return;
            }
            vm.UserAccount_Id = user.Id;
            var emp = BasicService.SaveEntity <Employee>(vm, ref res);

            UserManager.AddToRole(user.Id, "employee");
        }
예제 #2
0
        public void ClientSet(ClientVM vm, ref IMDResponse res)
        {
            var us   = vm.To <UserAccountVM>();
            var user = UserAccountSet(us, ref res);

            if (!res.HasNoErrors || user == null)
            {
                return;
            }
            var client = BasicService.SaveEntity <Client>(vm, ref res);

            DbHelper.OneToMany <UserAccount>(new UnitWork(), x => x.Client_Id = client.Id, ref res, user);
            UserManager.AddToRole(user.Id, "client");
            DoLogin(user);
        }