コード例 #1
0
        public static UseFullCategory Map(UseFullCategory modelToUpdate, UseFullUpdatePostInputDtoModel dtoModel)
        {
            modelToUpdate.ImageAddress = dtoModel.ImageAddress;
            modelToUpdate.Name         = dtoModel.UseFullCategoryName;

            return(modelToUpdate);
        }
コード例 #2
0
        public async Task CreateUseFullCategoryByNameAsync(string name, string imageAddress)
        {
            var towns = this.towns.All();

            if (imageAddress == null)
            {
                imageAddress = GlobalConstants.ImageAddress;
            }

            UseFullCategory useFullCategory = new UseFullCategory()
            {
                Name         = name,
                ImageAddress = imageAddress,
            };

            foreach (var town in towns)
            {
                TownUseFullCategory townUseFullCategory = new TownUseFullCategory()
                {
                    UseFullCategory = useFullCategory,
                    Town            = town,
                };

                await this.townUseFullCategories.AddAsync(townUseFullCategory);
            }

            await this.useFullCategories.AddAsync(useFullCategory);

            await this.useFullCategories.SaveChangesAsync();
        }
コード例 #3
0
        public static UseFullUpdateGetOutputDtoModel Map(UseFullCategory model)
        {
            var dtoOutputModel = new UseFullUpdateGetOutputDtoModel
            {
                UseFullCategoryId   = model.Id,
                UseFullCategoryName = model.Name,
                ImageAddress        = model.ImageAddress
            };

            return(dtoOutputModel);
        }
コード例 #4
0
        public static Company Map(CompanyInputViewDtoModel company, Town town, UseFullCategory useFullCategory)
        {
            var currentCompany = new Company()
            {
                Name            = company.Name,
                Town            = town,
                Address         = company.Address,
                Phone           = company.Phone,
                UseFullCategory = useFullCategory,
            };

            return(currentCompany);
        }
コード例 #5
0
        public static Company Map(Company companyForCange,
                                  CompanyUpdateInputDtoModel dtoModel,
                                  Town neededTown,
                                  UseFullCategory neededCategory)
        {
            companyForCange.Name            = dtoModel.CompanyName;
            companyForCange.Town            = neededTown;
            companyForCange.Address         = dtoModel.Address;
            companyForCange.Phone           = dtoModel.Phone;
            companyForCange.UseFullCategory = neededCategory;

            return(companyForCange);
        }
コード例 #6
0
ファイル: CompanySrvice.cs プロジェクト: kiovchev/SKAuto
        public async Task CreateCompanyAsync(CompanyInputViewModel company)
        {
            UseFullCategory useFullCategory = await this.useFullCategories.All()
                                              .FirstOrDefaultAsync(x => x.Name == company.CategoryName);

            Town town = await this.towns.All().FirstOrDefaultAsync(x => x.Name == company.TownName);

            Company currentCompany = new Company()
            {
                Name            = company.Name,
                Town            = town,
                Address         = company.Address,
                Phone           = company.Phone,
                UseFullCategory = useFullCategory,
            };

            await this.conpanies.AddAsync(currentCompany);

            await this.conpanies.SaveChangesAsync();
        }