6 Aug 05:22
Best Way?
From: Gustavo Melo <pipocadr <at> gmail.com>
Subject: Best Way?
Newsgroups: gmane.comp.programming.domain-driven-design
Date: 2008-08-06 03:26:35 GMT
Subject: Best Way?
Newsgroups: gmane.comp.programming.domain-driven-design
Date: 2008-08-06 03:26:35 GMT
Hello EverBody,
I'm a little confuse in how i implement some part of my application.
The picture shows how my app works today.
Look in webapp i don't use "Model" from MVC, bcuz all the model logic stay in DDD.
I'm wondering about how is the best way to do the logic below:
In my blog i want to save one POST.
So my Form in one View call one Action for Controller and send the parameters.
A)
Controller.cs
public virtual ActionResult IncludePost()
{
Post post = new Post();
post.Title = Request.Form["Title"];
post.Text = Request.Form["Text"];
post.Creation = DateTime.Now;
BlogService.AddPost(post);
return View("Message");
}
BlogService.cs
public void AddPost(string title, string text)
{
PostRepository.Add(post);
}
B)
Controller.cs
public virtual ActionResult IncludePost()
{
BlogService.AddPost(Request.Form["Title"], Request.Form["Text"]);
return View("Message");
}
BlogService.cs
public void AddPost(string title, string text)
{
Post post = new Post();
post.CreatPost(title, text);
PostRepository.Add(post);
}
Post.cs
public void CreatPost(string title, string text)
{
this.title = title;
this.text = text;
this.creation = DateTime.Now;
}
What is the best Way? A? B? Both? Neither?
Best Regards.
__._,_.___
I'm a little confuse in how i implement some part of my application.
The picture shows how my app works today.
Look in webapp i don't use "Model" from MVC, bcuz all the model logic stay in DDD.
I'm wondering about how is the best way to do the logic below:
In my blog i want to save one POST.
So my Form in one View call one Action for Controller and send the parameters.
A)
Controller.cs
public virtual ActionResult IncludePost()
{
Post post = new Post();
post.Title = Request.Form["Title"];
post.Text = Request.Form["Text"];
post.Creation = DateTime.Now;
BlogService.AddPost(post);
return View("Message");
}
BlogService.cs
public void AddPost(string title, string text)
{
PostRepository.Add(post);
}
B)
Controller.cs
public virtual ActionResult IncludePost()
{
BlogService.AddPost(Request.Form["Title"], Request.Form["Text"]);
return View("Message");
}
BlogService.cs
public void AddPost(string title, string text)
{
Post post = new Post();
post.CreatPost(title, text);
PostRepository.Add(post);
}
Post.cs
public void CreatPost(string title, string text)
{
this.title = title;
this.text = text;
this.creation = DateTime.Now;
}
What is the best Way? A? B? Both? Neither?
Best Regards.
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
RSS Feed