Last active
December 2, 2016 03:58
-
-
Save elderfo/980c3267fad78f90e2710231dc6057c5 to your computer and use it in GitHub Desktop.
Static keyword removed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Project.Logic; | |
namespace Project.Controllers | |
{ | |
public class ExampleController : Controller | |
{ | |
private readonly User _userLogic = new User(); | |
public JsonResult GetUser(Guid userId) | |
{ | |
UserModel user = _userLogic.Get(userId); | |
return Json(user, JsonRequestBehavior.AllowGet); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Project.Data; // enternal dependency | |
namespace Project.Logic | |
{ | |
public class User | |
{ | |
public UserModel Get(Guid userId) | |
{ | |
using (var entities = new Entities()) { | |
// ... | |
} | |
} | |
public List<UserModel> Get(Func<Data.User, bool> predicate = null) | |
{ | |
using (var entities = new Entities()) { | |
// ... | |
} | |
} | |
public UserModel Create(UserModel model) { ... } | |
public void Update(UserModel model) { ... } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment