public void AddTest() { IAdminService target = IoCContext.Container.Resolve<IAdminService>(); // TODO: Initialize to an appropriate value Administrator newModel = null; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.Add(newModel); Assert.AreEqual(expected, actual); newModel = new Administrator(); actual = target.Add(newModel); Assert.AreEqual(expected, actual); newModel = new Administrator { AdminName = "mediaAdmin", AdminPwd = "123" }; expected = true; actual = target.Add(newModel); Assert.AreEqual(expected, actual); }
/// <summary> /// Add New Administrator Entity /// </summary> /// <param name="newModel">new entity</param> /// <returns>is success</returns> public bool Add(Administrator newModel) { if (null == newModel) { return false; } if (string.IsNullOrEmpty(newModel.AdminName) || string.IsNullOrEmpty(newModel.AdminPwd)) { return false; } IAdminRepository iAdminRepos = IoCContext.Container.Resolve<IAdminRepository>(); if (!string.IsNullOrEmpty(newModel.AdminPwd)) { newModel.AdminPwd = EncryptUtil.Encrypt(newModel.AdminPwd); } int count = iAdminRepos.Add(newModel, false); return count > 0; }
/// <summary> /// Deprecated Method for adding a new object to the Administrators EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAdministrators(Administrator administrator) { base.AddObject("Administrators", administrator); }
/// <summary> /// Create a new Administrator object. /// </summary> /// <param name="adminId">Initial value of the AdminId property.</param> public static Administrator CreateAdministrator(global::System.Int16 adminId) { Administrator administrator = new Administrator(); administrator.AdminId = adminId; return administrator; }
private void FixupAdministrator(Administrator previousValue, bool skipKeys = false) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.DonationProjects.Contains(this)) { previousValue.DonationProjects.Remove(this); } if (Administrator != null) { if (!Administrator.DonationProjects.Contains(this)) { Administrator.DonationProjects.Add(this); } AdminId = Administrator.AdminId; } else if (!skipKeys) { AdminId = null; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Administrator") && (ChangeTracker.OriginalValues["Administrator"] == Administrator)) { ChangeTracker.OriginalValues.Remove("Administrator"); } else { ChangeTracker.RecordOriginalValue("Administrator", previousValue); } if (Administrator != null && !Administrator.ChangeTracker.ChangeTrackingEnabled) { Administrator.StartTracking(); } } }