Beispiel #1
0
        public async Task CreateSchool()
        {
            // Arrange
            var(db, configuration, mockLogger) = PrepareCommonServiceDependancies <SchoolService>();

            // Act
            var schoolService = new SchoolService(db, configuration, mockLogger);
            var schoolAdmin   = new School
            {
                Email       = "*****@*****.**",
                Name        = "ABC School",
                Address     = "96  Balsham Road, HASLAND",
                PhoneNumber = "07926059561"
            };
            var result = await schoolService.AddAsync(schoolAdmin);

            // Assert
            Assert.Equal(schoolAdmin, result);
        }
Beispiel #2
0
        public async Task <IActionResult> InsertSchool([FromBody] Schools entity)
        {
            ExceptionModel oResult = new ExceptionModel();

            try
            {
                bool isSuccess = await _svc.AddAsync(entity, "0");

                if (isSuccess)
                {
                    oResult.ErrorCode = (int)ExceptionType.SUCCESS;
                    oResult.ErrorDesc = ExceptionType.SUCCESS.ToString();
                }
            }
            catch (Exception ex)
            {
                oResult.ErrorCode = (int)ExceptionType.CATCH;
                oResult.ErrorDesc = ex.ToString();
            }
            return(Ok(oResult));
        }