2
votes
1answer
95 views

Please help me follow Repository Pattern properly

I am new to learning Repository Pattern. I am developing a site in MVC 4 ( I m new to it as well). The way I am using Repository pattern as follows: I created IRepository<T> interface as ...
2
votes
1answer
75 views

How can I make this code better

I hate having almost two identical blocks do almost the exact same thing. I am working with Entity Framework 4.4.0.0 Asp.Net MVC Right now if the user is a "manager" I want to show them the entire ...
1
vote
1answer
36 views

Making a property virtual to cause EF to load the property?

I am walking through a sample MVC4 ASP.Net tutorial available on PluralSight.com, by Scott Allen. I am in a section #5, Working with Data (part 2), "Listing Reviews". This application has a database ...
-1
votes
1answer
123 views

ASP.NET MVC 4 Shopping Cart - Cannot update shopping car items using JQuery , Ajax, jSON, jGrid [closed]

I have this code in a C# MVC 4 VS2012 project. I need to be able to update the shopping cart with jSON data using JQuery/AJAX, i'm using jqGrid to display the data and pulling the shopping cart items ...
1
vote
0answers
53 views

Best practices in implementing service methods

Consider the following architecture: ASP.NET MVC Application having controllers which depend on service classes (MembershipService, EmailService etc.) which in turn depend on data access context ...
1
vote
1answer
81 views

Truncate port number from absolute Uri

We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e Actual: https://mysitename:443/Home/Index Excepted: https://mysitename/Home/Index The code I used for ...
2
votes
1answer
77 views

Cropping and combining two images on server

I've coded following two methods to combine images that are HTTP POSTed to the server: // Crops two squares out of two separate images // And then combines them into single image that's returned as ...
3
votes
0answers
238 views

Is this the right way to inject AutoMapper profiles

I'd like to know if I'm doing profile configuration in the wrong place or in the wrong way. I'm following the Onion Architecture. So that restricts the direction of my dependencies towards the ...
6
votes
1answer
137 views

passing a selectlist to the view based on database models from viewmodel is a MVC anti-pattern?

We need to select a model reference from a view. To do this we need to add a dropdownlistfor. this is based on a selectlist containing database models. passing selectlists by viewbag this solves our ...
1
vote
1answer
139 views

What should I do to improve my first MVC 4 application built with C#

I've started learning .NET with MVC 4 in C# and I built a basic application to display records from a MySQL database. It's incredibly basic, but it's the best I could come up with being a complete ...
1
vote
0answers
27 views

PBKDF2 Authorization first go, is this optimal?

I've discovered that using hashed passwords with salts is much better idea than MD5/SHA256 so I'm not hashing them with PBKDF2. However I'm wondering if this is correct approach to authorize my user. ...
1
vote
1answer
102 views

How to dynamically Generate Sort strings for Data Layer from Controller

I need help refactoring this code to dynamically generate a sort string that I can send to my data layer so that my database does the sorting instead of it happening in memory. I am using MVC4 with ...
0
votes
2answers
159 views

How could I make my controller a little less hideous?

I have a controller. It functions as follows: A user imports a file and decides whether the files contents contain new entries to be placed into a database, or existing entries entries to be updated. ...
0
votes
1answer
90 views

Products table or Products + attributes when using EF + MVC 4 [closed]

What I need to build is a web application that maintains and shows products. A product has a lot of attributes, some that will be changed or added during the next year. I have 2 options for designing ...
4
votes
4answers
384 views

Is this bad code? (Instantiating if null)

I often have static classes which uses the DataContext somehow, and they all make a new DataContext, but often i allready have one instantiated elsewhere, so why not use that?. And then i would do ...

1 2
15 30 50 per page