Ejemplo n.º 1
0
 public IActionResult Registrate(Mst_System _param)
 {
     if (ModelState.IsValid)
     {
         this._context.Mst_System.Add(_param);
         this._context.SaveChanges();
         return(RedirectToAction("Index", "System"));
     }
     else
     {
         ViewBag.error = "更新に失敗しました。";
         return(View("New"));
     }
 }
Ejemplo n.º 2
0
        public IActionResult Update(Mst_System _params)
        {
            var _r = this._context.Mst_System.SingleOrDefault(x => x.Id == _params.Id);

            if (ModelState.IsValid)
            {
                _r.System_name = _params.System_name;
                _r.OmmitName   = _params.OmmitName;
                this._context.Entry(_r).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                this._context.SaveChanges();
            }
            else
            {
                var _result = this._context.Mst_System.Single(x => x.Id == _params.Id);
                return(View("Edit", _result));
            }
            return(RedirectToAction("Index", "System"));
        }
Ejemplo n.º 3
0
        public IActionResult Destroy(int id)
        {
            var _r = this._context.Tra_Inqury.Where(x => x.System_Id == id).Count();

            if (_r >= 1)
            {
                ViewBag.error = "過去に登録した問合せがあるため、削除できません。";
                var _result = this._context.Mst_System.OrderBy(x => x.Id);
                return(View("Index", _result));
            }
            else
            {
                Mst_System result_sys = this._context.Mst_System.Single(x => x.Id == id);
                this._context.Remove(result_sys);
                this._context.SaveChanges();
            }
            return(RedirectToAction("Index", "System"));
        }