public void GivenACustomFieldCategory_WhenUpdate_ThenContextSetsModified() { var expected = new CustomFieldCategory { Id = 1 }; Target.Update(expected); MockContext.AssertWasCalled(m => m.SetModified(expected)); }
public void GivenACustomFieldCategory_WhenRemove_ThenRemoveFromContext() { var item = new CustomFieldCategory { Id = 1 }; Target.Remove(item); MockDbSet.AssertWasCalled(m => m.Remove(item)); }
public void GivenACustomFieldCategory_WhenAdd_ThenAddToContext() { var expected = new CustomFieldCategory { Id = 1 }; Target.Add(expected); MockDbSet.AssertWasCalled(m => m.Add(expected)); }
public static string GetCustomFieldCategory(RestCommand command, int customFieldCategoryID) { CustomFieldCategory customFieldCategory = CustomFieldCategories.GetCustomFieldCategory(command.LoginUser, customFieldCategoryID); if (customFieldCategory.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(customFieldCategory.GetXml("CustomFieldCategory", true)); }
public void DeleteCategory(int categoryID) { if (!TSAuthentication.IsSystemAdmin) { return; } CustomFieldCategory cat = CustomFieldCategories.GetCustomFieldCategory(TSAuthentication.GetLoginUser(), categoryID); if (cat.OrganizationID != TSAuthentication.OrganizationID) { return; } cat.Delete(); cat.Collection.Save(); }
public CustomFieldCategoryProxy NewCategory(ReferenceType refType, int?auxID, string text, int productFamilyID) { if (!TSAuthentication.IsSystemAdmin) { return(null); } CustomFieldCategory cat = (new CustomFieldCategories(TSAuthentication.GetLoginUser()).AddNewCustomFieldCategory()); cat.Category = text.Trim(); cat.Position = CustomFieldCategories.GetMaxPosition(TSAuthentication.GetLoginUser(), refType, auxID) + 1; cat.OrganizationID = TSAuthentication.OrganizationID; cat.AuxID = auxID; cat.RefType = refType; if (productFamilyID != -1) { cat.ProductFamilyID = productFamilyID; } cat.Collection.Save(); return(cat.GetProxy()); }
public CustomFieldCategoryProxy SaveCategory(int categoryID, string text, int productFamilyID) { if (!TSAuthentication.IsSystemAdmin) { return(null); } CustomFieldCategory cat = CustomFieldCategories.GetCustomFieldCategory(TSAuthentication.GetLoginUser(), categoryID); if (cat.OrganizationID != TSAuthentication.OrganizationID) { return(null); } cat.Category = text.Trim(); if (productFamilyID != -1) { cat.ProductFamilyID = productFamilyID; } else { cat.ProductFamilyID = null; } cat.Collection.Save(); return(cat.GetProxy()); }
public void Update(CustomFieldCategory item) { Context.SetModified(item); }
public void Remove(CustomFieldCategory item) { Context.CustomFieldCategories.Remove(item); }
public void Add(CustomFieldCategory item) { Context.CustomFieldCategories.Add(item); }