Exemplo n.º 1
0
        public Recent Insert(Recent newObject)
        {
            var databaseObject = newObject.ToDBModel();

            DatabaseManager.Instance.Recent.Add(databaseObject);
            DatabaseManager.Instance.SaveChanges();

            return(databaseObject.ToRepositoryModel());
        }
Exemplo n.º 2
0
        public Recent Delete(Recent deleteObject)
        {
            var databaseObject = deleteObject.ToDBModel();
            var original       = DatabaseManager.Instance.Recent.Find(databaseObject.RecentId);

            DatabaseManager.Instance.Recent.Remove(original);
            DatabaseManager.Instance.SaveChanges();

            return(databaseObject.ToRepositoryModel());
        }
Exemplo n.º 3
0
        public Recent Update(Recent inputObject)
        {
            var updated  = inputObject.ToDBModel();
            var original = DatabaseManager.Instance.Recent.Find(updated.RecentId);

            if (original != null)
            {
                DatabaseManager.Instance.Entry(original).CurrentValues.SetValues(updated);
                DatabaseManager.Instance.SaveChanges();
                return(updated.ToRepositoryModel());
            }
            return(original.ToRepositoryModel());
        }