コード例 #1
0
        public IHttpActionResult GetSubjectByName(string name)
        {
            var subject = subjectRepo.GetByName(name);

            if (subject == null)
            {
                return(Content(HttpStatusCode.NotFound, "Item does not exist"));
            }

            return(Ok(subject));
        }
コード例 #2
0
        public void testAdd()
        {
            //Arrange
            int count = repo.All().Count();


            // Act
            this.repo.Add(entity);
            this.repo.SaveChanges();
            // Assert

            Assert.NotNull(repo.GetByName(n));

            this.repo.HardDelete(entity);
            this.repo.SaveChanges();
        }