Click here to Skip to main content
15,915,869 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionMVC, use of Models and Razor Pin
jkirkerx22-Jan-16 11:50
professionaljkirkerx22-Jan-16 11:50 
So I'm working in this MVC project of mine which will be quite large. I went ahead and created a separate DLL for the Data Access Layer instead of including it in the MVC project.

Then I have all these custom programs, so I created another DLL and separated those programs I had in the App_Code folder to the new DLL. I also took all the SQL Linq statements and put them there as well. So all of the Service References, Business Logic is there now.

I have these Models like the example below.
public class AdminLoginModel
    {
        [Required]
        [Display(Name = "Account Name")]
        [PlaceHolder("Enter your account name")]
        public string AccountName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        [PlaceHolder("Enter your secure password")]
        public string Password { get; set; }

        public DateTime LoginDate { get; set; }
        public string IPAddress { get; set; }
    }

I understand that the stuff like Required are System.ComponentModel.DataAnnotations. And I was previously using the model above to send to the SQL Linq request to populate the date for the model.

So my question:

But do I have to? I'm still new to MVC, and I remember thinking oh how cool, I can just send the model and populate it, but now I don't want to do that anymore, and I can't remember how I was doing it in the beginning.

Are the DataAnnotations like a Razor thing? Or Validation Thing?

I'm trying to keep it clean this time, and don't want to dump it all together into one basket.
I want to store all the classes I use to project data in the common DLL, and perhaps storing these models there as well.

I was looking at the Owin or Identity example, and it seems that it stores the models in it's DLL and not in the MVC project, Which seems more straight forward to me.

I just wanted to check before I make more modifications that may not be good practice to do.
AnswerRe: MVC, use of Models and Razor [solved] Pin
jkirkerx25-Jan-16 8:32
professionaljkirkerx25-Jan-16 8:32 
QuestionHow to redirect the weburl to particular country when user types in Browser. Pin
pradeep yajamanam21-Jan-16 3:18
pradeep yajamanam21-Jan-16 3:18 
AnswerRe: How to redirect the weburl to particular country when user types in Browser. Pin
F-ES Sitecore21-Jan-16 3:53
professionalF-ES Sitecore21-Jan-16 3:53 
QuestionPassword reset/token? Pin
Member 876166715-Jan-16 10:14
Member 876166715-Jan-16 10:14 
AnswerRe: Password reset/token? Pin
David Mujica15-Jan-16 10:49
David Mujica15-Jan-16 10:49 
GeneralRe: Password reset/token? Pin
Richard Deeming15-Jan-16 10:52
mveRichard Deeming15-Jan-16 10:52 
AnswerRe: Password reset/token? Pin
Richard Deeming15-Jan-16 10:59
mveRichard Deeming15-Jan-16 10:59 
AnswerRe: Password reset/token? Pin
Member 876166715-Jan-16 13:25
Member 876166715-Jan-16 13:25 
GeneralRe: Password reset/token? Pin
Richard Deeming15-Jan-16 23:44
mveRichard Deeming15-Jan-16 23:44 
GeneralRe: Password reset/token? Pin
Member 876166716-Jan-16 8:42
Member 876166716-Jan-16 8:42 
GeneralRe: Password reset/token? Pin
Richard Deeming18-Jan-16 1:06
mveRichard Deeming18-Jan-16 1:06 
GeneralRe: Password reset/token? Pin
Member 876166718-Jan-16 9:28
Member 876166718-Jan-16 9:28 
GeneralRe: Password reset/token? Pin
Richard Deeming18-Jan-16 10:21
mveRichard Deeming18-Jan-16 10:21 
GeneralRe: Password reset/token? Pin
Member 876166718-Jan-16 10:58
Member 876166718-Jan-16 10:58 
GeneralRe: Password reset/token? Pin
Member 876166726-Feb-16 14:41
Member 876166726-Feb-16 14:41 
GeneralRe: Password reset/token? Pin
Richard Deeming1-Mar-16 0:43
mveRichard Deeming1-Mar-16 0:43 
GeneralRe: Password reset/token? Pin
ZurdoDev18-Jan-16 10:04
professionalZurdoDev18-Jan-16 10:04 
GeneralRe: Password reset/token? Pin
Member 876166718-Jan-16 11:00
Member 876166718-Jan-16 11:00 
QuestionService names aren't Suffixing with Service NetTier code generation Pin
indian14314-Jan-16 15:34
indian14314-Jan-16 15:34 
Questiontouch screen application in C++ Pin
ginsa vaheed13-Jan-16 18:11
ginsa vaheed13-Jan-16 18:11 
AnswerRe: touch screen application in C++ Pin
JHizzle13-Jan-16 22:01
JHizzle13-Jan-16 22:01 
AnswerRe: touch screen application in C++ Pin
Richard MacCutchan13-Jan-16 22:04
mveRichard MacCutchan13-Jan-16 22:04 
AnswerRe: touch screen application in C++ Pin
Richard Deeming14-Jan-16 1:32
mveRichard Deeming14-Jan-16 1:32 
Questionmvc views Pin
Member 1144362713-Jan-16 4:54
Member 1144362713-Jan-16 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.