
* CatalogManager.cs: Uses GetDefaultProvider * Catalog.cs: the Catalog object now should support a unique id in the system : UID, exposed as one of its properties. * AccountController.cs: new static method te get an user profile by its name. * AdminController.cs: Uses the Yavsc.Admin namespace (refactoring) * Web.csproj: * BlogManager.cs: * BackOfficeController.cs: refactoring * BlogsController.cs: Fixes the Blog title * FrontOfficeController.cs: Changes on the go for the Command object * AddRole.aspx: minor syntax change * UserPosts.aspx: show the blog title * style.css: black transparent for the background of posts * Profile.cs: Method FromProfileBase became a constructor * Commande.cs: nothing * Estimate.aspx: moved to the frontoffice views * CatalogHelper.cs: Writting GetDefaultProvider
61 lines
1.3 KiB
C#
61 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace SalesCatalog.Model
|
|
{
|
|
/// <summary>
|
|
/// Catalog.
|
|
/// </summary>
|
|
public class Catalog {
|
|
|
|
/// <summary>
|
|
/// Gets or sets the catalog unique identifier in the system.
|
|
/// </summary>
|
|
/// <value>The unique identifier.</value>
|
|
string UID { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the brands.
|
|
/// </summary>
|
|
/// <value>The brands.</value>
|
|
public Brand[] Brands { get; set; }
|
|
|
|
public Brand GetBrand(string brandName)
|
|
{
|
|
return Array.Find<Brand>(Brands, b => b.Name == brandName);
|
|
}
|
|
|
|
public Brand AddBrand(string brandName,string slogan=null, ProductImage logo=null)
|
|
{
|
|
Brand[] oldbrs = (Brand[]) Brands.Clone ();
|
|
int oldl = Brands.Length;
|
|
Array.Resize<Brand>(ref oldbrs,oldl+1);
|
|
Brand b = new Brand ();
|
|
b.Name=brandName;
|
|
b.Slogan = slogan;
|
|
b.Logo = logo;
|
|
oldbrs [oldl] = b;
|
|
Brands=oldbrs;
|
|
return b;
|
|
}
|
|
|
|
public bool RemoveBrand(string brandName)
|
|
{
|
|
Brand b = this.GetBrand (brandName);
|
|
if (b == null)
|
|
return false;
|
|
//assert(Brands.Length>0);
|
|
List<Brand> nb = new List<Brand> (Brands);
|
|
nb.Remove (b);
|
|
Brands = nb.ToArray ();
|
|
return true;
|
|
}
|
|
|
|
public DateTime StartDate { get; set; }
|
|
|
|
public DateTime EndDate { get; set; }
|
|
|
|
}
|
|
|
|
}
|