public void CreateSupplier(SaveSupplierDto saveSupplierDto) { var product = _mapper.Map <SaveSupplierDto, Supplier>(saveSupplierDto); _unitOfWork.Suppliers.Add(product); _unitOfWork.Complete(); }
public IActionResult OnGet(int?id) { var t = Request.Cookies["logon"]; if (t == null) { return(RedirectToPage("../Accounts/Login")); } if (t == "false") { return(RedirectToPage("../Accounts/Login")); } if (id == null) { return(NotFound()); } var pSupplier = _service.GetSupplier(id ?? default(int)); if (pSupplier == null) { return(NotFound()); } Supplier = _mapper.Map <SupplierDto, SaveSupplierDto>(pSupplier); return(Page()); }
public void UpdateSupplier(SaveSupplierDto saveSupplierDto) { var product = _unitOfWork.Suppliers.GetBy(saveSupplierDto.id); if (product == null) { return; } _mapper.Map <SaveSupplierDto, Supplier>(saveSupplierDto, product); _unitOfWork.Complete(); }