当前位置: 首页>>代码示例>>C#>>正文


C# Author类代码示例

本文整理汇总了C#中Author的典型用法代码示例。如果您正苦于以下问题:C# Author类的具体用法?C# Author怎么用?C# Author使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Author类属于命名空间,在下文中一共展示了Author类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CommitChanges

 public DataObjectOperationResult CommitChanges(AuthorFormModel postedData)
 {
     Mapper.CreateMap<AuthorFormModel, Author>();
     var author = new Author(Db);
     Mapper.Map<AuthorFormModel, Author>(postedData, author);
     return author.Save();
 }
开发者ID:sympletech,项目名称:RavenDesk,代码行数:7,代码来源:AuthorWorker.cs

示例2: PutAuthor

        // PUT api/Authors/5
        public async Task<IHttpActionResult> PutAuthor(int id, Author author)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

            db.Entry(author).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AuthorExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:vihongphuc,项目名称:WebAPI2WithEF6,代码行数:33,代码来源:AuthorsController.cs

示例3: Bt_Update_Click

    protected void Bt_Update_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            Author author = new Author();
            author.LoadInfo(Request.Cookies["userID"].Value.ToString());
            if (txtPwdold.Text == author.authorPwd)
            {
                string xwhere = "where authorID=" + SQLString.GetQuotedString(Request.Cookies["userID"].Value.ToString());
                Hashtable ht = new Hashtable();
                ht.Add("authorPwd", SQLString.GetQuotedString(txtPwdnew.Text));
                if (author.Update(ht, xwhere))
                {
                    Response.Write("<Script Language=JavaScript>alert(\"密码修改成功!\")</Script>");

                }
                else
                {
                    Response.Write("<Script Language=JavaScript>alert(\"密码修改失败!\")</Script>");
                }

            }
            else
            {
                Response.Write("<Script Language=JavaScript>alert(\"旧密码错误!\")</Script>");

            }
        }
    }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:29,代码来源:modifypwd.aspx.cs

示例4: Main

        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.InputEncoding = Encoding.UTF8;

            int num = 153;
            Ex001_InformationOfNumber infoNum = new Ex001_InformationOfNumber(num);
            Console.WriteLine(infoNum.ToString());

            dynamic lastName = "Chand";
            dynamic dynAuthor = new Author();
            Console.WriteLine(dynAuthor.FullNameMethod(lastName));

            string strShow = String.Format("    Space     of     string:     {0}    ", ExerciseString.nbOfSpace(infoNum.ToString()));
            Console.WriteLine(strShow);
            ExerciseString.removeSpaceReduntion(ref strShow);
            Console.WriteLine(strShow);
            ExerciseString.concatString(ref strShow, "abc");
            Console.WriteLine(strShow);

            ExerciseString.stringLower(ref strShow);
            Console.WriteLine(strShow);

            //ExerciseString.stringUpper(ref strShow);
            //Console.WriteLine(strShow);

            ExerciseString.upperCharacterStartWord(ref strShow);
            Console.WriteLine(strShow);

            ExerciseString.upperAndLowerCharacterAlternate(ref strShow);
            Console.WriteLine(strShow);

            Console.ReadKey();
        }
开发者ID:CockDeveloper,项目名称:Exercise_resolve,代码行数:34,代码来源:Program.cs

示例5: OnAuthorUpdated

 public void OnAuthorUpdated(Author author)
 {
     if (AuthorUpdated != null)
     {
         AuthorUpdated(new SingleItemEventArgs<Author>(author));
     }
 }
开发者ID:tkirda,项目名称:BetterCMS,代码行数:7,代码来源:AuthorEvents.cs

示例6: Bt_login_Click

 protected void Bt_login_Click(object sender, EventArgs e)
 {
     string authorID = txtUserID.Text;
     string authorPwd = txtUserPwd.Text;
     Author author = new Author();
     int flag = author.Login(authorID, authorPwd);
     if (flag == 1)
     {
         author.LoadInfo(authorID);
         Response.Cookies["userID"].Value = txtUserID.Text;
         Response.Cookies["userID"].Expires = DateTime.Now.AddDays(7);
         Response.Cookies["userName"].Value = author.authorName;
         Response.Cookies["userName"].Expires = DateTime.Now.AddDays(7);
         Response.Cookies["userPwd"].Value = txtUserPwd.Text;
         Response.Cookies["userPwd"].Expires = DateTime.Now.AddDays(7);
         Response.Redirect("main.htm");
     }
     else if (flag == -1)
     {
         Response.Write("<Script Language=JavaScript>alert(\"密码错误!\")</Script>");
     }
     else if (flag == 0)
     {
         Response.Write("<Script Language=JavaScript>alert(\"用户名不存在!\")</Script>");
     }
 }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:26,代码来源:login.aspx.cs

示例7: OnlyLastName

 public void OnlyLastName()
 {
     Author a = new Author();
     a.Person = new Person { Last = "Bond", Degree = "Licensed to Kill" };
     Assert.Equal("Bond, Licensed to Kill", a.Person.ToString());
     Assert.Equal("^Bond^^^^^Licensed to Kill", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例8: Create5NewPageSuccessfulTest

        public void Create5NewPageSuccessfulTest()
        {
            using (UnitOfWork uow = new UnitOfWork())
            {
                PageRepository pr = new PageRepository(uow.Current);
                BlogRepository br = new BlogRepository(uow.Current);

                Blog.Model.Domain.Entities.Blog b = new Blog.Model.Domain.Entities.Blog("Nombe blog", "Desc blog");

                Category c = new Category("Categoria 1", "Desc 1");
                Author a = new Author("Nome autore", "Cognome autore", Convert.ToDateTime("27/12/1987"), "[email protected]", true, "pass", b);

                Page p1 = new Page("Nome pagina 1", "descr pagine", DateTime.Now, "test", a, b, c);
                Page p2 = new Page("Nome pagina 2", "descr pagine", DateTime.Now, "test", a, b, c);
                Page p3 = new Page("Nome pagina 3", "descr pagine", DateTime.Now, "test", a, b, c);
                Page p4 = new Page("Nome pagina 4", "descr pagine", DateTime.Now, "test", a, b, c);
                Page p5 = new Page("Nome pagina 5", "descr pagine", DateTime.Now, "test", a, b, c);

                br.Save(b);
                pr.Save(p1);
                pr.Save(p2);
                pr.Save(p3);
                pr.Save(p4);
                pr.Save(p5);

                uow.Commit();
            }
        }
开发者ID:raowyr,项目名称:BlogProject,代码行数:28,代码来源:PageRepositoryTest.cs

示例9: FullMonty

 public void FullMonty()
 {
     Author a = new Author();
     a.Person = new Person { Prefix = "Sir", First = "Tom", MI = "A", Last = "Jones", Suffix = "Jr.", Degree = "M.D., PhD, JD, PharmD" };
     Assert.Equal("Sir Tom A Jones, Jr., M.D., PhD, JD, PharmD", a.Person.ToString());
     Assert.Equal("^Jones^Tom^A^Jr.^Sir^M.D., PhD, JD, PharmD", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例10: Celebrity

 public void Celebrity()
 {
     Author a = new Author();
     a.Person = new Person { Prefix = "Lady", First = "Gaga", Degree = "M.A." };
     Assert.Equal("Lady Gaga, M.A.", a.Person.ToString());
     Assert.Equal("^^Gaga^^^Lady^M.A.", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例11: MD

 public void MD()
 {
     Author a = new Author();
     a.Person = new Person { First = "Tom", Last = "Jones", Degree = "M.D." };
     Assert.Equal("Tom Jones, M.D.", a.Person.ToString());
     Assert.Equal("^Jones^Tom^^^^M.D.", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例12: AuthorWithMI

 public void AuthorWithMI()
 {
     Author a = new Author();
     a.Person = new Person { First="Tom", Last="Jones", MI="A" };
     Assert.Equal("Tom A Jones", a.Person.ToString());
     Assert.Equal("^Jones^Tom^A^^^", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例13: SimpleAuthor

 public void SimpleAuthor()
 {
     Author a = new Author();
     a.Person = new Person { First = "Tom", Last = "Jones" };
     Assert.Equal("Tom Jones", a.Person.ToString());
     Assert.Equal("^Jones^Tom^^^^", a.Person.ToXCN());
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:7,代码来源:AuthorFacts.cs

示例14: MakePersistent_BookTitle_AddsBookTitleToRepository

        public void MakePersistent_BookTitle_AddsBookTitleToRepository()
        {
            var authors = new Author[] {new Author("Jeffery","Palermo"),
                                        new Author("Ben","Scheirman"),
                                        new Author("Jimmy","Bogard")};

            //Mock a BookTitle
            var mockBookTitle = new Mock<BookTitle>();
            mockBookTitle.Setup(book => book.Title).Returns("ASP.NET MVC 2 in Action");
            mockBookTitle.Setup(book => book.Authors).Returns(new List<Author>(authors));
            mockBookTitle.Setup(book => book.Publisher).Returns(new Publisher("Manning"));

            //Mock a BookTitleRepository
            var mockBookTitleRepository = new Mock<IBookTitleRepository>();
            mockBookTitleRepository
                .Setup(bookTitleRepository => bookTitleRepository.MakePersistent(mockBookTitle.Object))
                .Returns(mockBookTitle.Object);

            //Act
            var persistentBookTitle = mockBookTitleRepository.Object.MakePersistent(mockBookTitle.Object);

            //Asserts
            Assert.NotNull(persistentBookTitle);
            Assert.Equal<string>(persistentBookTitle.Title, "ASP.NET MVC 2 in Action");
            Assert.NotNull(persistentBookTitle.Publisher);
            Assert.Equal<string>(persistentBookTitle.Publisher.Name, "Manning");
            Assert.NotEmpty(persistentBookTitle.Authors);
        }
开发者ID:ghenadie,项目名称:Mvc.BooksOnline,代码行数:28,代码来源:BookTitleRepositoryTests.cs

示例15: PostAuthor

        public IHttpActionResult PostAuthor(AuthorBindingModel authorBinding)
        {
            if (authorBinding == null)
            {
                return this.BadRequest("Input is empty.");
            }

            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var author = new Author
                             {
                                 FirstName = authorBinding.FirstName, 
                                 LastName = authorBinding.LastName
                             };

            this.Data.Authors.Create(author);
            this.Data.SaveChanges();

            var authorView = new AuthorViewModel
                                 {
                                     FirstName = author.FirstName, 
                                     LastName = author.LastName
                                 };

            return this.Ok(authorView);
        }
开发者ID:iliankostov,项目名称:WebServicesAndCloud,代码行数:29,代码来源:AuthorsController.cs


注:本文中的Author类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。