示例#1
0
 public HttpResponseMessage UpdateUserTk(Guid userId, string firstName, string lastName, string email, string culture, bool enable, bool activate, Guid groupId, Guid?managerId)
 {
     try
     {
         TakeDocService.Security.Interface.IUserTkService servUser = Utility.MyUnityHelper.UnityHelper.Resolve <TakeDocService.Security.Interface.IUserTkService>();
         ICollection <TakeDocModel.UserTk> users = servUser.GetBy(x => x.UserTkId == userId);
         if (users.Count != 1)
         {
             throw new Exception("Invalid user");
         }
         TakeDocModel.UserTk user = users.First();
         user.UserTkFirstName = firstName;
         user.UserTkLastName  = lastName;
         user.UserTkEmail     = email;
         user.UserTkCulture   = culture;
         user.UserTkEnable    = enable;
         user.UserTkActivate  = activate;
         user.UserTkGroupId   = groupId;
         user.UserTkManagerId = managerId;
         servUser.Update(user);
         return(Request.CreateResponse(HttpStatusCode.OK, true));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
示例#2
0
 public HttpResponseMessage GetAllUser()
 {
     TakeDocService.Security.Interface.IUserTkService servUser = Utility.MyUnityHelper.UnityHelper.Resolve <TakeDocService.Security.Interface.IUserTkService>();
     try
     {
         ICollection <TakeDocModel.UserTk> users = servUser.GetAll();
         return(Request.CreateResponse(users));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
示例#3
0
 public HttpResponseMessage GetById(Guid userId)
 {
     try
     {
         TakeDocService.Security.Interface.IUserTkService servUser = Utility.MyUnityHelper.UnityHelper.Resolve <TakeDocService.Security.Interface.IUserTkService>();
         TakeDocModel.UserTk user = servUser.GetBy(x => x.UserTkId == userId).First();
         return(Request.CreateResponse(HttpStatusCode.OK, string.Concat(user.UserTkFirstName, " ", user.UserTkLastName)));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
示例#4
0
 public HttpResponseMessage Delete(Guid userId, Guid currentUserId)
 {
     try
     {
         TakeDocService.Security.Interface.IUserTkService servUser = Utility.MyUnityHelper.UnityHelper.Resolve <TakeDocService.Security.Interface.IUserTkService>();
         servUser.Delete(userId, currentUserId);
         return(Request.CreateResponse(HttpStatusCode.OK, true));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }