public FunctionCallStatus AddCategories(string categoryName, string categoryURL) { using (SantaBantaDataContext santaBantaDataContext = new SantaBantaDataContext()) { List<Categories> categorieses = new List<Categories>(); categorieses = WebSite.GetAllCategories(); int categoriesExistanceCheck = categorieses.Where(i => i.CategoryName == categoryName).ToList().Count; if (categoriesExistanceCheck == 0) { Category category = new Category(); category.CategoryName = categoryName; category.CategoryURL = categoryURL; santaBantaDataContext.Categories.InsertOnSubmit(category); santaBantaDataContext.SubmitChanges(); if (category.Id > 0) { return FunctionCallStatus.Success; } else { return FunctionCallStatus.Error; } } else { return FunctionCallStatus.DataAlreadyExists; } } }
partial void UpdateCategory(Category instance);
partial void DeleteCategory(Category instance);
partial void InsertCategory(Category instance);