/// <summary> /// Deletes a Branch /// </summary> /// <param name="branch">Branch</param> public virtual void DeleteBranch(Branch branch) { if (branch == null) throw new ArgumentNullException("branch"); _branchRepository.Delete(branch); //event notification _eventPublisher.EntityDeleted(branch); }
public virtual void RemoveBranch(Branch branch) { if (this.Branches.Contains(branch)) this.Branches.Remove(branch); }
public virtual void AddBranch(Branch branch) { if (!this.Branches.Contains(branch)) this.Branches.Add(branch); }
public object Clone() { var addr = new Branch() { Name = this.Name, Website = this.Website, Email = this.Email, Country = this.Country, CountryId = this.CountryId, StateProvince = this.StateProvince, StateProvinceId = this.StateProvinceId, City = this.City, Address1 = this.Address1, Address2 = this.Address2, ZipPostalCode = this.ZipPostalCode, PhoneNumber = this.PhoneNumber, FaxNumber = this.FaxNumber, CreatedOnUtc = this.CreatedOnUtc, DisplayOrder = this.DisplayOrder, }; return addr; }
public void UpdateLocalesBranch(Branch branch, BranchModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(branch, x => x.Name, localized.Name, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(branch, x => x.City, localized.City, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(branch, x => x.Address1, localized.Address1, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(branch, x => x.Address2, localized.Address2, localized.LanguageId); } }
public static Branch ToEntity(this BranchModel model, Branch destination) { return Mapper.Map(model, destination); }
/// <summary> /// Updates the Branch /// </summary> /// <param name="branch">Branch</param> public virtual void UpdateBranch(Branch branch) { if (branch == null) throw new ArgumentNullException("branch"); //some validation if (branch.CountryId == 0) branch.CountryId = null; if (branch.StateProvinceId == 0) branch.StateProvinceId = null; _branchRepository.Update(branch); //event notification _eventPublisher.EntityUpdated(branch); }
/// <summary> /// Inserts a branch /// </summary> /// <param name="branch">Branch</param> public virtual void InsertBranch(Branch branch) { if (branch == null) throw new ArgumentNullException("branch"); branch.CreatedOnUtc = DateTime.UtcNow; //some validation if (branch.CountryId == 0) branch.CountryId = null; if (branch.StateProvinceId == 0) branch.StateProvinceId = null; _branchRepository.Insert(branch); //event notification _eventPublisher.EntityInserted(branch); }