Beispiel #1
0
        public string Add(systems newSystem)
        {
            string ret = "";

            db.systems.Add(newSystem);
            return(ret);
        }
Beispiel #2
0
        public string Delete(string systemId)
        {
            string  ret;
            systems deleteSystem = getById(systemId);

            ret = Delete(deleteSystem);
            return(ret);
        }
Beispiel #3
0
        public string Delete(systems deleteSystem)
        {
            string ret = "";

            db.Entry(deleteSystem).State = EntityState.Deleted;
            // need save changes
            return(ret);
        }
Beispiel #4
0
        public string Update(systems updateSystem)
        {
            string ret     = "";
            var    aSystem = db.systems.SingleOrDefault(x => x.systemId
                                                        == updateSystem.systemId);

            if (aSystem != null)
            {
                aSystem = reflectionUtl.assign <systems, systems>(
                    aSystem, updateSystem);
                db.Entry(aSystem).State = EntityState.Modified;
            }
            else
            {
                throw new Exception($"system {updateSystem.systemId}" +
                                    $" not found");
            }
            return(ret);
        }
Beispiel #5
0
 public systemEditViewModel()
 {
     editModel = new systems();
 }