public StatusEnum.Status UpdateUser(UserModel model) { StatusEnum.Status status = StatusEnum.Status.Success; try { RS.Entity.Models.Users user = _userRepository.GetByID(model.UserId); user.UserName = model.UserName; //user.TelMobile = model.TelMobile; //user.TelMainTwo = model.TelMainTwo; //user.TelMainOne = model.TelMainOne; //user.Telex = model.Telex; //user.Prefix = model.Prefix; //user.Password = model.Password; //user.OfficeId = Guid.NewGuid(); //user.ModifiedDateTime = null; //user.MiddleName = model.MiddleName; //user.LastName = model.LastName; //user.LastLoginDateTime = null; //user.IsDeleted = false; //user.IsActive = true; //user.FirstName = model.FirstName; //user.EntityId = model.EntityId; //user.EmailAddress = model.emailAddress; //user.DeletedDateTime = null; //user.CreatedDateTime = DateTime.UtcNow; _userRepository.Update(user); _userRepository.SaveChanges(); } catch (Exception) { status = StatusEnum.Status.Fail; } return(status); }
public StatusEnum.Status DeleteUser(Guid id) { StatusEnum.Status status = StatusEnum.Status.Success; try { RS.Entity.Models.Users userDelete = _userRepository.GetByID(id); //userDelete.IsDeleted = true; _userRepository.Update(userDelete); _userRepository.SaveChanges(); } catch (Exception) { status = StatusEnum.Status.Fail; } return(status); }
public StatusEnum.Status SaveUser(UserModel model) { StatusEnum.Status status = StatusEnum.Status.Success; try { _user = new RS.Entity.Models.Users(); _user.UserName = model.UserName; _user.Password = model.Password; _user.Email = model.Email; _userRepository.Create(_user); _userRepository.SaveChanges(); } catch (Exception) { status = StatusEnum.Status.Fail; } return(status); }