Example #1
0
        public virtual ApiAdminClientRequestModel MapServerResponseToClientRequest(
            ApiAdminServerResponseModel response)
        {
            var request = new ApiAdminClientRequestModel();

            request.SetProperties(
                response.Email,
                response.FirstName,
                response.LastName,
                response.Password,
                response.Phone,
                response.Username);
            return(request);
        }
Example #2
0
        public virtual ApiAdminServerResponseModel MapServerRequestToResponse(
            int id,
            ApiAdminServerRequestModel request)
        {
            var response = new ApiAdminServerResponseModel();

            response.SetProperties(id,
                                   request.Email,
                                   request.FirstName,
                                   request.LastName,
                                   request.Password,
                                   request.Phone,
                                   request.Username);
            return(response);
        }
Example #3
0
        public virtual ApiAdminServerResponseModel MapEntityToModel(
            Admin item)
        {
            var model = new ApiAdminServerResponseModel();

            model.SetProperties(item.Id,
                                item.Email,
                                item.FirstName,
                                item.LastName,
                                item.Password,
                                item.Phone,
                                item.Username);

            return(model);
        }
Example #4
0
        public void MapEntityToModel()
        {
            var   mapper = new DALAdminMapper();
            Admin item   = new Admin();

            item.SetProperties(1, "A", "A", "A", "A", "A", "A");
            ApiAdminServerResponseModel response = mapper.MapEntityToModel(item);

            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.Id.Should().Be(1);
            response.LastName.Should().Be("A");
            response.Password.Should().Be("A");
            response.Phone.Should().Be("A");
            response.Username.Should().Be("A");
        }
Example #5
0
        public virtual ApiVenueServerResponseModel MapEntityToModel(
            Venue item)
        {
            var model = new ApiVenueServerResponseModel();

            model.SetProperties(item.Id,
                                item.Address1,
                                item.Address2,
                                item.AdminId,
                                item.Email,
                                item.Facebook,
                                item.Name,
                                item.Phone,
                                item.ProvinceId,
                                item.Website);
            if (item.AdminIdNavigation != null)
            {
                var adminIdModel = new ApiAdminServerResponseModel();
                adminIdModel.SetProperties(
                    item.AdminIdNavigation.Id,
                    item.AdminIdNavigation.Email,
                    item.AdminIdNavigation.FirstName,
                    item.AdminIdNavigation.LastName,
                    item.AdminIdNavigation.Password,
                    item.AdminIdNavigation.Phone,
                    item.AdminIdNavigation.Username);

                model.SetAdminIdNavigation(adminIdModel);
            }

            if (item.ProvinceIdNavigation != null)
            {
                var provinceIdModel = new ApiProvinceServerResponseModel();
                provinceIdModel.SetProperties(
                    item.ProvinceIdNavigation.Id,
                    item.ProvinceIdNavigation.CountryId,
                    item.ProvinceIdNavigation.Name);

                model.SetProvinceIdNavigation(provinceIdModel);
            }

            return(model);
        }
Example #6
0
        public virtual async Task <UpdateResponse <ApiAdminServerResponseModel> > Update(
            int id,
            ApiAdminServerRequestModel model)
        {
            var validationResult = await this.AdminModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                Admin record = this.DalAdminMapper.MapModelToEntity(id, model);
                await this.AdminRepository.Update(record);

                record = await this.AdminRepository.Get(id);

                ApiAdminServerResponseModel apiModel = this.DalAdminMapper.MapEntityToModel(record);
                await this.mediator.Publish(new AdminUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiAdminServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiAdminServerResponseModel> .UpdateResponse(validationResult));
            }
        }
 public void SetAdminIdNavigation(ApiAdminServerResponseModel value)
 {
     this.AdminIdNavigation = value;
 }
Example #8
0
 public AdminUpdatedNotification(ApiAdminServerResponseModel record)
 {
     this.Record = record;
 }