Exemple #1
0
        public async Task <IActionResult> AddAlertImage(AlertImageViewModel model)
        {
            if (ModelState.IsValid)
            {
                var path = string.Empty;

                if (model.ImageFile != null)
                {
                    path = await _imageHelper.UpLoadImageAsync(model.ImageFile);
                }

                var alert = await _converterHelper.ToAlertImageAsync(model, path, true);

                _datacontext.AlertImages.Add(alert);
                await _datacontext.SaveChangesAsync();

                return(RedirectToAction($"AlertImagetList/{model.Alert_id}"));
            }

            return(View(model));
        }