public void Create(ref DtoClient dtoClient) { var model = dtoClient.ToRepository(); var address = dtoClient.Addresses.Where(i => i.Id == 0); var insertdId = Insert(model, "Client"); var addresses = dtoClient.Addresses.Where(i => i.Id == 0).Select(i => i.ToRepository(insertdId)); Insert(addresses, "Address"); dtoClient.Id = insertdId; dtoClient.Addresses = GetAllAddress(dtoClient.Token); }
public void UpdateClient(ref DtoClient dtoClient) { var model = dtoClient.ToRepository(); var dbClient = this.GetClient(dtoClient.Token); model.Id = dbClient.Id; if (model.PasswordHash == null) { model.PasswordHash = dbClient?.PasswordHash; } this.Update(model, "Client"); }