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