public async Task <Customer> AddCustomer(Customer customer)
        {
            if (customer != null)
            {
                await context.AddAsync(customer);

                await context.SaveChangesAsync();

                return(customer);
            }
            return(null);
        }
Exemple #2
0
        public async Task <Event> AddEvent(Event eventParams)
        {
            if (eventParams != null)
            {
                await context.AddAsync(eventParams);

                await context.SaveChangesAsync();

                return(eventParams);
            }
            return(null);
        }
Exemple #3
0
        public async Task <Configuration> UpdateConfiguration(int id, Configuration configuration)
        {
            var configurationUpdate = context.Configurations.Find(id);

            if (configurationUpdate != null)
            {
                configurationUpdate.GiaTri = configuration.GiaTri;
                configurationUpdate.GhiChu = configuration.GhiChu;
                context.Configurations.Update(configurationUpdate);
                await context.SaveChangesAsync();

                return(configurationUpdate);
            }
            return(null);
        }