本文整理汇总了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();
}
示例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);
}
示例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>");
}
}
}
示例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();
}
示例5: OnAuthorUpdated
public void OnAuthorUpdated(Author author)
{
if (AuthorUpdated != null)
{
AuthorUpdated(new SingleItemEventArgs<Author>(author));
}
}
示例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>");
}
}
示例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());
}
示例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();
}
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}