protected async Task HandleValidSubmit()
        {
            if (Category.CategoryId == 0)
            {
                var response = await CategoryDataService.Add(Category);

                if (response.Errors.Any())
                {
                    ShowError   = true;
                    Errors      = response.Errors;
                    StatusClass = "alert-danger";
                }
                else
                {
                    StatusClass = "alert-success";
                    Message     = "New category added successfully.";
                }
            }
            else
            {
                await CategoryDataService.Update(Category);

                StatusClass = "alert-success";
                Message     = "Category updated successfully.";
            }
        }
Esempio n. 2
0
        public void AddRouteMapForCategory()
        {
            Category category = repository.FindMany(c => c.RouteMapInfo == null).OrderBy(c => Guid.NewGuid()).FirstOrDefault();

            if (category != null)
            {
                RouteMap newEntity = new RouteMap();
                newEntity.InsertDate = DateTime.Now;
                newEntity.ItemType   = typeof(Category).FullName;
                newEntity.ItemId     = category.CategoryId;
                newEntity.Slug       = StringOperations.UrlFriendlyString(category.Name);

                category.RouteMapInfo = newEntity;

                dataService.Update(category);
                dataService.Save();

                Assert.AreNotEqual(Guid.Empty, newEntity.RouteMapId);
            }
            else
            {
                Assert.Inconclusive("Rota atanacak kategori bilgisi kalmadı");
            }
        }