public void Test_Add_ListAll()
        {
            Customer cust = new Customer()
            {
                Id = 1,
                FirstName = "Someone",
                MiddleName = "Else",
                LastName = "Name",
                Email = "*****@*****.**",
                StreetName = "Bla Vej",
                StreetNumber = 1,
                Password = "******"
            };

            CustomerRepository repository = new CustomerRepository();

            int numberOfCustomers = repository.GetAll().Count();

            Customer result = repository.Add(cust);
            Assert.NotNull(result);

            int finalNumberOfCustomers = repository.GetAll().Count();

            Assert.AreEqual(numberOfCustomers + 1, finalNumberOfCustomers);
        }
 /// <summary>
 /// Add a customer and returns it
 /// </summary>
 public Customer Add(Customer cust)
 {
     using (var ctx = new MovieShopContext())
     {
         Customer newCust = ctx.Customers.Add(cust);
         ctx.SaveChanges();
         return newCust;
     }
 }
        public IHttpActionResult PostCustomer(Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            customerRepository.Add(customer);

            return CreatedAtRoute("DefaultApi", new { id = customer.Id }, customer);
        }
        public IHttpActionResult PutCustomer(int id, Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != customer.Id)
            {
                return BadRequest();
            }

            customerRepository.Update(customer);

            return StatusCode(HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Change a customer
        /// </summary>
        public Customer Update(Customer cust)
        {
            using (var ctx = new MovieShopContext())
            {
                var customer = ctx.Customers.Where(c => c.Id == cust.Id).FirstOrDefault();
                customer.FirstName = cust.FirstName;
                customer.MiddleName = cust.MiddleName;
                customer.LastName = cust.LastName;
                customer.StreetName = cust.StreetName;
                customer.StreetNumber = cust.StreetNumber;
                customer.Email = cust.Email;
                customer.Password = cust.Password;

                ctx.SaveChanges();
                return customer;
            }
        }
 public bool ChangeActive(Customer item)
 {
     throw new System.NotImplementedException();
 }