public void Create(Discount discount) { try { var mapDisocunt = AutoMapper.Mapper.Map <Data.Entities.Discount>(discount); _discountRepository.Add(mapDisocunt); _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }
public void Update(Discount discount) { try { var mapDisocunt = AutoMapper.Mapper.Map <Data.Entities.Discount>(discount); var actualDiscount = _discountRepository .FindBy(d => d.Id == mapDisocunt.Id) .First(); actualDiscount.Name = mapDisocunt.Name; actualDiscount.Percent = mapDisocunt.Percent; actualDiscount.Description = mapDisocunt.Description; actualDiscount.IsDeleted = mapDisocunt.IsDeleted; _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }