コード例 #1
0
        private async void OnSave()
        {
            var rawMaterialsToDb = RestproMapper
                                   .MapWpfRawMaterialLIstToRawMaterialList(RawMaterials.ToList());
            string errorMessage = null;

            try
            {
                _unitOfWork.RawMaterials.AddOrUpdateRawMaterials(rawMaterialsToDb);
                LoadRawMaterials();
                await dialogCoordinator.ShowMessageAsync(this, "Success", "Items Saved Successfully. You Rock!");
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                errorMessage = e.Message;
            }

            if (errorMessage == null)
            {
                return;
            }

            await dialogCoordinator
            .ShowMessageAsync(this, "Error"
                              , "Fatal Error Occured. You're Screwed!\n" +
                              errorMessage);
        }