Пример #1
0
        public async Task <IActionResult> Delete(UserTypeDto userTypeDto)
        {
            UserType userType = _mapper.Map <UserType>(userTypeDto);
            await _userTypeManager.RemoveAsync(userType);

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <IActionResult> Delete(int id)
        {
            UserType userType = await _userTypeManager.FindById(id);

            UserTypeDto userTypeDto = _mapper.Map <UserTypeDto>(userType);

            return(View(userTypeDto));
        }
 public void Add(UserTypeDto dto)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         var entity = MapperFactory.Map <UserTypeDto, UserType>(dto);
         uow.GetRepository <UserType>().Add(entity);
         uow.SaveChanges();
     }
 }
        private UserType MapToEntity(UserTypeDto type)
        {
            var t = new UserType
            {
                HomeTeamGoals = type.HomeTeamGoals,
                AwayTeamGoals = type.AwayTeamGoals,
                UserId        = type.UserId
            };

            return(t);
        }
        public ActionResult UpdateType(UserTypeModel model)
        {
            var type = new UserTypeDto
            {
                AwayTeamGoals = model.AwayTeamGoals,
                HomeTeamGoals = model.HomeTeamGoals,
                UserId        = model.UserId
            };

            userBetsService.UpdateType(type);
            return(Ok());
        }
Пример #6
0
        public UserTypeDto BuildDto(IUserType entity)
        {
            var userType = new UserTypeDto
            {
                Alias = entity.Alias,
                DefaultPermissions = entity.Permissions == null ? "" : string.Join("", entity.Permissions),
                Name = entity.Name
            };

            if (entity.HasIdentity)
            {
                userType.Id = short.Parse(entity.Id.ToString());
            }

            return(userType);
        }
Пример #7
0
        public static UserTypeDto ToUserTypeDto(this UserType userType)
        {
            if (userType == null)
            {
                return(null);
            }

            var userTypeDto = new UserTypeDto
            {
                Id        = userType.Id,
                Name      = userType.Name,
                UsersList = userType.Users.Select(x => x.ToUserDto()).ToList()
            };

            return(userTypeDto);
        }
Пример #8
0
        public IUserType BuildEntity(UserTypeDto dto)
        {
            var userType = new UserType
            {
                Alias       = dto.Alias,
                Id          = dto.Id,
                Name        = dto.Name,
                Permissions = dto.DefaultPermissions.IsNullOrWhiteSpace()
                                      ? Enumerable.Empty <string>()
                                      : dto.DefaultPermissions.ToCharArray().Select(x => x.ToString(CultureInfo.InvariantCulture))
            };

            //on initial construction we don't want to have dirty properties tracked
            // http://issues.umbraco.org/issue/U4-1946
            userType.ResetDirtyProperties(false);
            return(userType);
        }
        public static UserType ToModel(this UserTypeDto dto)
        {
            var json       = dto.Properties.ToJson();
            var properties = FieldInfoCollectionJsonConverter.Deserialize(json);

            return(new UserType
            {
                Id = dto.Id,
                Name = dto.Name,
                Description = dto.Description,
                Properties = new ReadOnlyCollection <IFieldInfo>(properties.ToList()),
                AllowAdditionalProperties = dto.AllowAdditionalProperties,
                IsAbstract = dto.IsAbstract,
                IsSealed = dto.IsSealed,
                BaseUserType = dto.BaseUserType,
                MembershipId = dto.MembershipId,
                Sys = dto.Sys.ToModel()
            });
        }
Пример #10
0
 /// <summary>
 /// Updates user type over user type contract client.
 /// </summary>
 /// <param name="dto">User type dto which has to be updated.</param>
 public void UpdateUserTypeDetails(UserTypeDto dto)
 {
     _utcc.UpdateUserTypeDetails(dto);
 }
Пример #11
0
 /// <summary>
 /// Inserts user types over user types contract client.
 /// </summary>
 /// <param name="dto">User types dto which has to be inserted.</param>
 public void InsertUserTypeDetails(UserTypeDto dto)
 {
     _utcc.InsertUserTypeDetails(dto);
 }
Пример #12
0
 /// <summary>
 /// Deletes user type over user type contract client.
 /// </summary>
 /// <param name="dto">User type dto which has to be deleted.</param>
 public void DeleteUserTypeDetails(UserTypeDto dto)
 {
     _utcc.DeleteUserTypeDetails(dto);
 }
        public void UpdateType(UserTypeDto type)
        {
            var t = MapToEntity(type);

            userTypeRepository.Update(t);
        }
        public void AddType(UserTypeDto type)
        {
            var t = MapToEntity(type);

            userTypeRepository.Insert(t);
        }
Пример #15
0
 public IActionResult SaveUserTypes(UserTypeDto userTypeDto)
 {
     return(new ObjectResult(_userService.SaveUserTypes(Mapper.Map <UserTypeDto, IUserType>(userTypeDto))));
 }