public async Task <IActionResult> Edit(string id, [Bind("Material,MaterialDescription,CalPlace,CalVendor,CalInterval,Instruction,AddRemove,ChangeDate,NeedCal,NeedSafety,SafetyInterval,PMaker,PName,PModel")] MaterialNeedCal materialNeedCal)
        {
            if (id != materialNeedCal.Material)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materialNeedCal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialNeedCalExists(materialNeedCal.Material))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(materialNeedCal));
        }
        public async Task <IActionResult> Create([Bind("Material,MaterialDescription,CalPlace,CalVendor,CalInterval,Instruction,AddRemove,ChangeDate,NeedCal,NeedSafety,SafetyInterval,PMaker,PName,PModel")] MaterialNeedCal materialNeedCal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(materialNeedCal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(materialNeedCal));
        }
        public ActionResult SavePInfo([FromBody] MProdInfo PInfoData)
        {
            MaterialNeedCalRepository matrep = _context.MaterialNeedCalRepository;
            MaterialNeedCal           entry  = matrep.GetRecord(PInfoData.Material);

            entry.PMaker = PInfoData.PMaker;
            entry.PModel = PInfoData.PModel;
            entry.PName  = PInfoData.PName;
            matrep.UpdateRecord(entry);
            return(Json("Ok"));
        }