コード例 #1
0
        public ActionResult Create(ProductVM productVM, IFormFile FilePicture)
        {
            try
            {
                PictureVM imageEntity = GeneratePicture.CreatePicture(FilePicture, $"{productVM.Name} - {productVM.Description}");
                productVM.Picture = imageEntity;

                if (string.IsNullOrEmpty(productVM.DT_RowId))
                {
                    _productAppService.Add(productVM);
                }
                else
                {
                    _productAppService.Update(productVM);
                }

                if (_notificationContext.HasNotifications)
                {
                    ViewData["Notifications"] = _notificationContext.Notifications.ToList();
                    return(View());
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public IActionResult CreateTrackingTypes(TrackingTypeVM trackingTypeVM, IFormFile FilePicture)
        {
            try
            {
                PictureVM imageEntity = GeneratePicture.CreatePicture(FilePicture, $"{trackingTypeVM.Description}");
                trackingTypeVM.Picture = imageEntity;

                _boxTrackingApplicationService.AddTraceType(trackingTypeVM);
                return(RedirectToAction("TrackingTypes"));
            }
            catch (CustomException exc)
            {
                throw exc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public IActionResult CreateBoxType(BoxTypeVM boxTypeVM, IFormFile FilePicture)
        {
            try
            {
                PictureVM imageEntity = GeneratePicture.CreatePicture(FilePicture, $"{boxTypeVM.Name} - {boxTypeVM.Description}");
                boxTypeVM.Picture = imageEntity;

                _boxApplicationService.AddBoxType(boxTypeVM);

                return(RedirectToAction("BoxesType"));
            }
            catch (CustomException exc)
            {
                throw exc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }