public IActionResult Create() { _logger.LogInfo($"Zapytanie do metody Create()"); var model = new CreateMedicineViewModel(); return(View(model)); }
public CreateMedicineViewModel GetCreateMedicineViewModel() { var viewModel = new CreateMedicineViewModel() { CreateMedicineDto = new CreateMedicineDto() }; return(viewModel); }
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; }
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)); }