Beispiel #1
0
        public async Task <string> SaveAddressCategory(AddressCategory addressCategory)
        {
            string msg = "error";

            int response = await addressCategoryService.SaveAddressCategory(addressCategory);

            if (response == 1)
            {
                msg = "success";
            }

            return(msg);
        }
Beispiel #2
0
        public async Task <int> SaveAddressCategory(AddressCategory addressCategory)
        {
            if (addressCategory.Id != 0)
            {
                _context.AddressCategories.Update(addressCategory);

                await _context.SaveChangesAsync();

                return(1);
            }

            await _context.AddressCategories.AddAsync(addressCategory);

            await _context.SaveChangesAsync();

            return(1);
        }
Beispiel #3
0
        public static string Translate(this AddressCategory category, Translator translator)
        {
            switch (category)
            {
            case AddressCategory.Home:
                return(translator.Get("Enum.AddressCategory.Home", "Value 'Home' in enum address category", "Home"));

            case AddressCategory.Work:
                return(translator.Get("Enum.AddressCategory.Work", "Value 'Work' in enum address category", "Work"));

            case AddressCategory.Mobile:
                return(translator.Get("Enum.AddressCategory.Mobile", "Value 'Mobile' in enum address category", "Mobile"));

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #4
0
 public NamedIntViewModel(Translator translator, AddressCategory category, bool selected)
     : this((int)category, category.Translate(translator), selected)
 {
 }