public GetUserOut GetUser(GetUserIn input) { GetUserOut output = new GetUserOut() { result = Entities.Common.Result.Error }; using (var dataContext = DataContextHelper.GetDataContext <UserDataContext>()) { var linqResult = dataContext.spr_getUser(input.usr_userName).FirstOrDefault(); if (linqResult != null) { output.user = new Entities.Database.User() { usrID = linqResult.usrID, usr_code = linqResult.usr_code, usr_userName = linqResult.usr_userName, usr_password = linqResult.usr_password, usr_fullName = linqResult.usr_fullName, usr_documentType = linqResult.usr_documentType, usr_numberDocument = linqResult.usr_numberDocument, usr_email = linqResult.usr_email, usr_balance = linqResult.usr_balance, usr_role = linqResult.usr_role, usr_status = linqResult.usr_status }; output.result = Entities.Common.Result.Success; } else { output.result = Entities.Common.Result.NoRecords; } } return(output); }
//[CustomAuthorizationFilterAttribute] public IHttpActionResult GetUser(GetUserIn input) { if (ModelState.IsValid) { var user = new SystemManagement.Business.Controllers.User(); var getUserOut = user.GetUser(input); return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.OK, getUserOut))); } else { var output = new GetUserOut(); output.result = SystemManagement.Entities.Common.Result.Error; output.message = DetailErrorBadRequest(ModelState); return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, output))); } }
public GetUserOut GetUser(GetUserIn input) { var output = new GetUserOut() { result = Entities.Common.Result.Error }; var request = new Business.User.User(); var getUserByFilterOut = request.GetUser(new MethodParameters.User.GetUserIn() { usr_userName = input.usr_userName }); if (getUserByFilterOut.user != null) { var user = new MethodParameters.Controllers.SystemManagementApi.User.GetUserOut.UserResult() { usrID = getUserByFilterOut.user.usrID, usr_code = getUserByFilterOut.user.usr_code, usr_userName = getUserByFilterOut.user.usr_userName, usr_password = getUserByFilterOut.user.usr_password, usr_fullName = getUserByFilterOut.user.usr_fullName, usr_documentType = getUserByFilterOut.user.usr_documentType, usr_numberDocument = getUserByFilterOut.user.usr_numberDocument, usr_email = getUserByFilterOut.user.usr_email, usr_balance = getUserByFilterOut.user.usr_balance, usr_role = getUserByFilterOut.user.usr_role, usr_creationUser = getUserByFilterOut.user.usr_creationUser, usr_creationDate = getUserByFilterOut.user.usr_creationDate, usr_modificationUser = getUserByFilterOut.user.usr_modificationUser, usr_modificationDate = getUserByFilterOut.user.usr_modificationDate, usr_status = getUserByFilterOut.user.usr_status }; output.resultGetUser = user; } if (getUserByFilterOut.result == Entities.Common.Result.Success) { output.result = Entities.Common.Result.Success; } return(output); }