コード例 #1
0
        public ResponseUpdateWindow UpdateWindow(int id, RequestUpdateWindow request)
        {
            var imagePath = string.Empty;

            if (!(string.IsNullOrEmpty(request.FileData) || string.IsNullOrEmpty(request.FileName)))
            {
                imagePath = SaveImageToWorksampleDirectory(request.FileName, request.FileData, CATALOG_DIRECTORY);
            }

            var windowItem = dbManager.GetById(id);

            if (windowItem == null)
            {
                throw new Exception("Не найдено ПВХ окно в БД");
            }

            windowItem.Name     = request.Name;
            windowItem.Feature  = request.Feature;
            windowItem.HasSetup = request.HasSetup;

            if (!string.IsNullOrEmpty(imagePath))
            {
                windowItem.ImageUrl = imagePath;
            }

            windowItem.Size  = request.Size;
            windowItem.Total = request.Total;

            dbManager.UpdateWindowPlastic(windowItem);

            return(new ResponseUpdateWindow());
        }