Ejemplo n.º 1
0
        public async Task <AttendanceRecord> CreateAsync(AttendanceRecordViewModel model)
        {
            // Create the entity
            var toCreate = mapper.Map <AttendanceRecord>(model);

            // Send to repository
            var created = await repository.CreateAsync(toCreate);

            if (created == null)
            {
                throw new Exception();
            }

            // Save changes
            await repository.SaveChangesAsync();

            return(created);
        }