Esempio n. 1
0
 public UserDto AddNewUserToTeam(AddNewUserToTeamRequest request)
 {
     try
     {
         return(_teamLogic.AddnewUserToTeam(request).Map());
     }
     catch (Exception e)
     {
         throw new FaultException("Sikertelen lekérdezés!");
     }
 }
Esempio n. 2
0
        public async Task <UserDto> AddNewUserToTeam(AddNewUserToTeamRequest request)
        {
            string uri = "api/team/AddNewUserToTeam";

            var addUserToTeam = await httpServices.Post <UserDto, AddNewUserToTeamRequest>(uri, request);

            if (addUserToTeam == null)
            {
                throw new Exception("Nem sikerült a mentés!");
            }

            return(addUserToTeam);
        }
Esempio n. 3
0
        public async Task <ActionResult> AddNewUserForTeam(AddNewUserToTeamViewModel model)
        {
            AddNewUserToTeamViewModel addNewUser;
            var request = new AddNewUserToTeamRequest
            {
                CurrencyId   = model.CurrencyId,
                TeamId       = model.Id,
                UserID       = model.UserId,
                PrivatePrice = model.PrivatePrice,
                PublicPrice  = model.PublicPrice
            };

            try
            {
                await TeamServiceClient.AddNewUserToTeam(request);

                return(RedirectToAction("DetalisTeam", "Team", new { id = request.TeamId }));
            }
            catch (Exception e)
            {
                ViewBag.Message = e.Message;

                if (Session["User"] != null && Session["Role"].ToString() == "Admin")
                {
                    addNewUser = new AddNewUserToTeamViewModel
                    {
                        TeamList     = await TeamServiceClient.GetAllTeam(),
                        UserList     = await UserServiceClient.GetAllUser(),
                        CurrencyList = await TeamServiceClient.GetAllCurrency()
                    };
                }
                else
                {
                    addNewUser = new AddNewUserToTeamViewModel
                    {
                        TeamList     = await TeamServiceClient.GetTeamsToUser(Session["User"].ToString()),
                        UserList     = await UserServiceClient.GetAllUser(),
                        CurrencyList = await TeamServiceClient.GetAllCurrency()
                    };
                }
            }
            return(View(addNewUser));
        }
Esempio n. 4
0
        public User AddnewUserToTeam(AddNewUserToTeamRequest request)
        {
            User user = new User();

            var userTeamLink = new UserTeamLink
            {
                PublicPrice  = request.PublicPrice,
                PrivatePrice = request.PrivatePrice,
                CurrencyId   = request.CurrencyId,
                UserID       = request.UserID,
                TeamId       = request.TeamId,
                Id           = request.Id
            };

            using (var db = new TimeTrackerModelContainer())
            {
                db.UserTeamLink.Add(userTeamLink);
                db.SaveChanges();

                user.Id = userTeamLink.UserID;
            }

            return(user);
        }