private SaveResult CreateProductCategory( ProductCategoryModel model, ContentManagementDb db ) { try { ProductCategory productCategory = new ProductCategory(); productCategory.Initialise(); AutoMap.Map( model, productCategory ); productCategory.DomainId = UserSession.Current.DomainId; db.ProductCategories.Add( productCategory ); db.SaveChanges(); return SaveResult.Success; } catch// (Exception ex) { return SaveResult.Fail; } }
private SaveResult UpdateProductCategory( ProductCategory product, ProductCategoryModel model, ContentManagementDb db ) { if ( UserSession.Current.IsAdministrator == false ) return SaveResult.AccessDenied; if ( UserSession.Current.CurrentDomain( db ).CanAccess( product ) == false ) return SaveResult.IncorrectDomain; try { AutoMap.Map( model, product ); product.UpdateTimeStamp(); db.SaveChanges(); return SaveResult.Success; } catch { return SaveResult.Fail; } }
public ProductCategoriesListItemModel( ProductCategory productCategory ) { AutoMap.Map( productCategory, this ); }