public void UpdateSource(SourceModel p)
        {
            Source_of_income ph = db.Sources.GetItem(p.Source_of_income_PK);

            db.Sources.Update(toSource(ph, p));
            db.Save();
        }
        private Source_of_income toSource(Source_of_income p, SourceModel i)
        {
            p.Name_Source_of_income = i.Name_Source_of_income;
            p.Source_of_income_PK   = i.Source_of_income_PK;

            return(p);
        }
 private SourceModel toSourceModel(Source_of_income i)
 {
     return(new SourceModel()
     {
         Name_Source_of_income = i.Name_Source_of_income,
         Source_of_income_PK = i.Source_of_income_PK
     });
 }
        public void DeleteSource(int id)
        {
            Source_of_income o = db.Sources.GetItem(id);

            if (o != null)
            {
                db.Sources.Delete(id);
            }
            db.Save();
        }
 public AddSourceViewModel(FinancesDBContext dbContext)
 {
     this.dbContext      = dbContext;
     CurrentSource       = new Source_of_income();
     ApplyChangesCommand = new RelayCommand(AddSource, CanExe);
 }