Exemplo n.º 1
0
        public async Task <ActionResult> OnPost()
        {
            if (ModelState.IsValid)
            {
                if (!(await MaterialAlloyDataAccess.CheckIfDescriptionIsUnique(Description)))
                {
                    Message = new PopUpMessageModel()
                    {
                        IsMessageGood = false,
                        Text          = "A material alloy already exists with that description."
                    };

                    await SetUpProperties();

                    return(Page());
                }

                var alloyToAdd = new MaterialAlloyModel()
                {
                    Description      = Description,
                    MaterialSeriesId = SeriesId
                };

                var result = await MaterialAlloyDataAccess.CreateMaterialAlloy(alloyToAdd); //Not sure what to do with the result.  It will just be the alloy passed in but with an updated alloyId.

                return(RedirectToPage("MaterialAlloyEntry", new { aMessage = "Alloy saved successfully", isMessageGood = true }));
            }
            else
            {
                await SetUpProperties();

                return(Page());
            }
        }
Exemplo n.º 2
0
 private async Task SetUpProperties()
 {
     PartModels       = (await PartDataAccess.GetAllParts()).ToList();
     UoMModels        = (await UoMDataAccess.GetAllUoMs()).ToList();
     DepartmentModels = (await DepartmentDataAccess.GetAllDepartments()).ToList();
     AlloyModels      = (await MaterialAlloyDataAccess.GetAllMaterialAlloys()).ToList();
     SeriesModels     = (await MaterialSeriesDataAccess.GetAllMaterialSeries()).ToList();
 }
Exemplo n.º 3
0
        public async Task SetUpProperties()
        {
            AllMaterialSeries = (await MaterialSeriesDataAccess.GetAllMaterialSeries()).ToList();

            AllMaterialAlloys = (await MaterialAlloyDataAccess.GetAllMaterialAlloys()).ToList();
        }