Exemple #1
0
        public IActionResult Create()
        {
            _logger.LogInfo($"Zapytanie do metody Create()");

            var model = new CreateMedicineViewModel();

            return(View(model));
        }
Exemple #2
0
        public CreateMedicineViewModel GetCreateMedicineViewModel()
        {
            var viewModel = new CreateMedicineViewModel()
            {
                CreateMedicineDto = new CreateMedicineDto()
            };

            return(viewModel);
        }
Exemple #3
0
        public void CraeteMedicineViewModelToMedicineViewModel()
        {
            var create = new CreateMedicineViewModel
            {
                Amount       = 1,
                MedType      = MedType.Liquid,
                Name         = "Test medicine",
                RefundString = "25%",
                Unit         = Unit.Grams,
                UnitPrice    = 100
            };

            var m = Mapper.Map <Medicine>(create);

            return;
        }
Exemple #4
0
        public IActionResult Create(CreateMedicineViewModel model)
        {
            _logger.LogInfo($"Zapytanie do metody Create(model)", new { model });

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var result = _medicineRepo.Add(model);

            if (result.IsSuccess)
            {
                return(RedirectToIndex());
            }

            return(RedirectToIndex(result.FailureMessage));
        }