hytos / ID2.Manager / ID2.Manager.Controller / Controllers / UserController.cs @ 3bdce96d
이력 | 보기 | 이력해설 | 다운로드 (1.77 KB)
1 | 8164f84e | yoush97 | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | c52f8bbe | yoush97 | using ID2.Manager.Dapper; |
8 | 8164f84e | yoush97 | using ID2.Manager.Data.Models; |
9 | using ID2.Manager.Dapper.Repository; |
||
10 | |||
11 | namespace ID2.Manager.Controller.Controllers |
||
12 | { |
||
13 | public class UserController : BaseController |
||
14 | { |
||
15 | 709c1971 | yoush97 | public IEnumerable<UserInfo> GetAllUserInfo() |
16 | { |
||
17 | 91e72bfe | yoush97 | IEnumerable<UserInfo> ret = null; |
18 | |||
19 | try |
||
20 | { |
||
21 | using (UserRepository rep = new UserRepository(this._MSSQLCONNSTR)) |
||
22 | { |
||
23 | ret = rep.GetAllUserInfo(); |
||
24 | } |
||
25 | } |
||
26 | catch (Exception ex) |
||
27 | 709c1971 | yoush97 | { |
28 | 91e72bfe | yoush97 | throw ex; |
29 | 709c1971 | yoush97 | } |
30 | 91e72bfe | yoush97 | |
31 | return ret; |
||
32 | 709c1971 | yoush97 | } |
33 | |||
34 | 8164f84e | yoush97 | public UserInfo GetUserInfo(string userId, string userPW) |
35 | { |
||
36 | 91e72bfe | yoush97 | UserInfo ret = null; |
37 | |||
38 | try |
||
39 | 8164f84e | yoush97 | { |
40 | 91e72bfe | yoush97 | using (UserRepository rep = new UserRepository(this._MSSQLCONNSTR)) |
41 | { |
||
42 | ret = rep.GetUserInfo(userId, userPW); |
||
43 | } |
||
44 | 8164f84e | yoush97 | } |
45 | 91e72bfe | yoush97 | catch (Exception ex) |
46 | { |
||
47 | throw ex; |
||
48 | } |
||
49 | |||
50 | return ret; |
||
51 | } |
||
52 | |||
53 | public bool SetUserInfo(UserInfo userInfo) |
||
54 | { |
||
55 | c52f8bbe | yoush97 | return SetUserInfo(userInfo, DMLType.NONE); |
56 | } |
||
57 | |||
58 | public bool SetUserInfo(UserInfo userInfo, DMLType dmlType) |
||
59 | { |
||
60 | 91e72bfe | yoush97 | bool ret = false; |
61 | |||
62 | try |
||
63 | { |
||
64 | using (UserRepository rep = new UserRepository(this._MSSQLCONNSTR)) |
||
65 | { |
||
66 | c52f8bbe | yoush97 | ret = rep.SetUserInfo(userInfo, dmlType); |
67 | 91e72bfe | yoush97 | } |
68 | } |
||
69 | catch(Exception ex) |
||
70 | { |
||
71 | throw ex; |
||
72 | } |
||
73 | |||
74 | return ret; |
||
75 | 8164f84e | yoush97 | } |
76 | } |
||
77 | } |