public static CustomerModel GetModelFromContract(CustomerContractsModel customer) { return(new CustomerModel { Id = customer.Id, FirestName = customer.FirestName, MiddleName = customer.MiddleName, LastName = customer.LastName, PassportNumber = customer.PassportNumber, BirthDate = customer.BirthDate }); }
public bool Add(CustomerContractsModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } using (_context) { this._customer = ModelConverterHelper.GetModelFromContract(model); this._context.Customer.Add(this._customer); } return(true); }
public bool Save(CustomerContractsModel customer) { if (customer == null) { throw new ArgumentNullException(nameof(customer)); } this._customer = ModelConverterHelper.GetModelFromContract(customer); using (_context) { var customerModel = _context.Customer.FirstOrDefault(x => x.Id == this._customer.Id); customerModel = _customer; _context.SaveChanges(); } return(true); }