Esempio n. 1
0
        public void Remove(int id)
        {
            using (var Context = new DomainModel.DTO.EF.OnlineShoppingEntities())
            {
                try
                {
                    var Ref_Person = new Person();
                    Ref_Person = Context.Person.Find(id);
                    Context.Person.Remove(Ref_Person);



                    Context.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    if (Context != null)
                    {
                        Context.Dispose();
                    }
                }
            }
        }
Esempio n. 2
0
        public void Insert(string name, string surname, int username, int password)
        {
            using (var Context = new DomainModel.DTO.EF.OnlineShoppingEntities())
            {
                try
                {
                    DTO.EF.Person Ref_Person = new DTO.EF.Person();
                    Ref_Person.FirstName = name;
                    Ref_Person.Surname   = surname;
                    Ref_Person.UserName  = (username);
                    Ref_Person.Password  = (password);
                    Context.Person.Add(Ref_Person);
                    Context.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }


                finally
                {
                    if (Context != null)
                    {
                        Context.Dispose();
                    }
                }
            }
        }