/// <summary> /// Creates the specified DTO. /// </summary> /// <param name="dal">The DTO.</param> /// <exception cref="ArgumentNullException">DAL</exception> public void Create(AccountDal dal) { if (ReferenceEquals(dal, null)) { throw new ArgumentNullException($"{nameof(dal)} is null"); } Account temp = dal.ToOrmAccount(); context.Accounts.Add(temp); }
/// <summary> /// Updates the specified DTO. /// </summary> /// <param name="dal">The DTO.</param> /// <exception cref="ArgumentNullException">DTO is null.</exception> /// <exception cref="ArgumentException">DTO.</exception> public void Update(AccountDal dal) { if (ReferenceEquals(dal, null)) { throw new ArgumentNullException($"{nameof(dal)} is null"); } Account temp = context.Accounts.FirstOrDefault(item => item.Id == dal.Id); if (ReferenceEquals(temp, null)) { throw new ArgumentException($"{nameof(dal)} doesn't contains in the storage"); } temp = dal.ToOrmAccount(); }