Ejemplo n.º 1
0
        /// <summary>
        /// Save group settings
        /// </summary>
        /// <param name="model">the group setting model</param>
        /// <returns></returns>
        public ResponseModel SaveGroupSettings(GroupManageSettingModel model)
        {
            var group = GetById(model.Id);

            if (group != null)
            {
                group.Settings = SerializeUtilities.SerializeObject(model.GroupSettingModel);
                var response = Update(group);

                return(response.SetMessage(response.Success
                                               ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateSettingSuccessfully:::Update group settings successfully.")
                                               : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateSettingFailure:::Update group settings failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::ObjectNotFounded:::Rotating image group is not founded.")
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageRotatingImageGroup(GridOperationEnums operation, RotatingImageGroupModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <RotatingImageGroupModel, RotatingImageGroup>();
            RotatingImageGroup rotatingImageGroup;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                rotatingImageGroup              = _rotatingImageGroupRepository.GetById(model.Id);
                rotatingImageGroup.Name         = model.Name;
                rotatingImageGroup.RecordOrder  = model.RecordOrder;
                rotatingImageGroup.RecordActive = model.RecordActive;
                response = Update(rotatingImageGroup);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateSuccessfully:::Update group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateFailure:::Update group failed. Please try again later.")));

            case GridOperationEnums.Add:
                rotatingImageGroup          = Mapper.Map <RotatingImageGroupModel, RotatingImageGroup>(model);
                rotatingImageGroup.Settings = string.Empty;
                var groupSettingModel = new GroupSettingModel();
                rotatingImageGroup.Settings = SerializeUtilities.SerializeObject(groupSettingModel);
                response = Insert(rotatingImageGroup);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateSuccessfully:::Create group successfully")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateFailure:::Insert group failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteSuccessfully:::Delete group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteFailure:::Delete group failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::ObjectNotFounded:::Rotating Image Group is not founded.")
            });
        }