コード例 #1
0
ファイル: PartsService.cs プロジェクト: IT-Careers/pc-craft
        public async Task <bool> CreateRAMPart(RAMServiceModel rAMServiceModel)
        {
            RAM rAMEntity = rAMServiceModel.To <RAM>();

            rAMEntity.Id = Guid.NewGuid().ToString();

            bool result = await this.pCCDbContext.AddAsync(rAMEntity) != null;

            await this.pCCDbContext.SaveChangesAsync();

            return(result);
        }
コード例 #2
0
        public async Task <IActionResult> CreateRAM(CreateRAMBindingModel createRAMBindingModel)
        {
            RAMServiceModel serviceModel = createRAMBindingModel.To <RAMServiceModel>();

            string url = await this.cloudinaryService.UploadImage(createRAMBindingModel.FileUpload);

            serviceModel.ImageUrl = url;

            bool result = await this.partsService.CreateRAMPart(serviceModel);

            return(Redirect("/"));
        }