コード例 #1
0
ファイル: EducController.cs プロジェクト: Fyntiche/AISLTP
        public string Create([Bind(Exclude = "Id")] Educ Model)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            string msg;

            try
            {
                if (ModelState.IsValid)
                {
                    db.Educs.Add(Model);

                    db.SaveChanges();
                    msg = "Сохранено успешно";
                }
                else
                {
                    msg = "Данные не прошли проверку ввода";
                }
            }
            catch (Exception ex)
            {
                msg = "Произошла ошибка:" + ex.Message;
            }
            return(msg);
        }
コード例 #2
0
ファイル: EducController.cs プロジェクト: Fyntiche/AISLTP
        public string Delete(int Id)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            Educ Educs = db.Educs.Find(Id);

            db.Educs.Remove(Educs);
            db.SaveChanges();
            return("Удалено успешно");
        }
コード例 #3
0
ファイル: EducStat.cs プロジェクト: Gigi220/BumSimulator
 public bool Is(IObject PropertyStat)
 {
     if (PropertyStat is EducStat)
     {
         if ((PropertyStat as EducStat).Educ != null)
         {
             foreach (EEduc x in (PropertyStat as EducStat).Educ)
             {
                 if (Educ.Contains(x) == false)
                 {
                     System.Windows.MessageBox.Show("Потрібно " + x.ToString());
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
コード例 #4
0
ファイル: EducStat.cs プロジェクト: Gigi220/BumSimulator
 public bool NegativeEffect(IObject otherStat)
 {
     if (otherStat is EducStat)
     {
         if ((otherStat as EducStat).Educ != null)
         {
             foreach (EEduc x in (otherStat as EducStat).Educ)
             {
                 if (Educ.Contains(x))
                 {
                     Educ.Remove(x);
                     OnPropertyChanged("HighestEduc");
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #5
0
ファイル: EducController.cs プロジェクト: Fyntiche/AISLTP
        public string Edit(Educ Model)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            string msg;

            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                    msg = "Сохранено успешно";
                }
                else
                {
                    msg = "Данные не прошли проверку ввода";
                }
            }
            catch (Exception ex)
            {
                msg = "Произошла ошибка:" + ex.Message;
            }
            return(msg);
        }