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)); } }
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)); } }